gitwtfhub

wtf is soar?

xiaomi/soar — explained in plain English

Analysis updated 2026-06-24

8,774GoAudience · ops devopsComplexity · 3/5LicenseSetup · moderate

TL;DR

Command-line tool from Xiaomi that analyzes MySQL SQL statements and automatically suggests performance improvements, index recommendations, and query rewrites without needing to manually read execution plans.

Mindmap

mindmap
  root((SOAR))
    What it does
      Analyzes SQL queries
      Suggests indexes
      Rewrites SQL
    Features
      EXPLAIN parser
      Index recommendations
      SQL formatting
      ALTER merge
    Custom rules
      Team SQL conventions
      Auto correction
    Platforms
      Linux
      Mac
      Windows partial

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Why would anyone build with this?

REASON 1

Run a slow MySQL query through SOAR to get specific index recommendations and a plain-English EXPLAIN breakdown

REASON 2

Use SOAR's SQL formatter to normalize and compress query strings in a codebase for readability

REASON 3

Merge multiple ALTER TABLE statements targeting the same table into one command to avoid repeated table locks during schema changes

What's in the stack?

GoMySQL

How it stacks up

xiaomi/soarrkt/rktcontainers/buildah
Stars8,7748,7808,783
LanguageGoGoGo
Setup difficultymoderatehardmoderate
Complexity3/54/53/5
Audienceops devopsops devopsops devops

Figures from each repo's GitHub metadata at analysis time.

How do you spin it up?

Difficulty · moderate Time to first run · 30min

Requires a running MySQL instance to connect to for EXPLAIN analysis and index suggestion.

Apache 2.0, use freely in any commercial or private project, just retain the copyright notice.

Wtf does this do

SOAR stands for SQL Optimizer And Rewriter. It is a command-line tool, built by Xiaomi's database team, that analyzes MySQL SQL statements and suggests or applies improvements automatically. It was designed to help developers and database administrators write better-performing queries without needing to manually trace every execution plan. The tool works by examining submitted SQL and applying a set of heuristic optimization rules. For queries that could benefit from additional indexes, SOAR can suggest multi-column index structures covering SELECT, INSERT, UPDATE, and DELETE operations. It can also parse the output of MySQL's EXPLAIN command and translate the technical details into a more readable explanation, making it easier to understand why a query is running slowly. Beyond optimization advice, SOAR can reformat and compress SQL for readability, generate a fingerprint (a normalized version of the statement with literal values removed), and merge multiple ALTER TABLE statements targeting the same table into one, which avoids the cost of repeated table locking during schema changes. Custom rewrite rules are also supported, so teams can encode their own SQL conventions and have SOAR flag or automatically correct statements that violate them. The README and most of the linked documentation are written in Chinese. A separate English README file is available in the repository. The tool runs on Linux and Mac, with Windows supported in principle though not fully tested. It is released under the Apache 2.0 license.

Yoink these prompts

Prompt 1
I have a slow MySQL SELECT with multiple JOINs, show me the SOAR command to analyze it and explain the index recommendations it gives
Prompt 2
How do I use SOAR to merge several ALTER TABLE statements on the same table into a single operation to reduce locking?
Prompt 3
Set up a SOAR custom rewrite rule that flags any SQL query missing a WHERE clause in an UPDATE or DELETE statement

Frequently asked questions

wtf is soar?

Command-line tool from Xiaomi that analyzes MySQL SQL statements and automatically suggests performance improvements, index recommendations, and query rewrites without needing to manually read execution plans.

What language is soar written in?

Mainly Go. The stack also includes Go, MySQL.

What license does soar use?

Apache 2.0, use freely in any commercial or private project, just retain the copyright notice.

How hard is soar to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is soar for?

Mainly ops devops.

View the repo → Decode another repo

This repo across BitVibe Labs

Don't trust strangers blindly. Verify against the repo.