explaingit

meituan-dianping/sqladvisor

5,631CAudience · ops devopsComplexity · 3/5Setup · moderate

TLDR

SQLAdvisor analyzes your SQL queries and recommends which database indexes to add so they run faster, no query execution, just actionable advice.

Mindmap

mindmap
  root((sqladvisor))
    What it does
      Analyzes SQL queries
      Recommends indexes
      No DB modification
    How it works
      MySQL syntax parser
      Checks WHERE filters
      Checks JOINs and GROUP BY
    Use cases
      Slow query tuning
      Pre-production audit
      DBA assistance
    Audience
      DBAs
      Backend devs
      Ops teams
Click or tap to explore — scroll the page freely

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

Things people build with this

USE CASE 1

Paste a slow SQL query and get specific index recommendations to speed it up.

USE CASE 2

Audit database queries during development before they hit production.

USE CASE 3

Optimize MySQL database performance without manually analyzing query plans.

Tech stack

CMySQL

Getting it running

Difficulty · moderate Time to first run · 30min

Requires compiling from C source and having a MySQL environment available.

License information is not clearly stated in the explanation.

In plain English

SQLAdvisor is a tool built by the database administration team at Meituan-Dianping, a large Chinese technology company. Its job is to look at a SQL query (the kind of command used to ask questions of a database) and suggest which indexes should be added to make that query run faster. An index in a database is a bit like the index at the back of a book: it helps the database find rows quickly without scanning through everything. The tool parses the SQL using MySQL's own syntax rules, then examines the filtering conditions, grouping operations, and any joins between tables to figure out what indexes would help most. You give it a SQL statement and it tells you what to add. It does not run the query itself or modify your database, it only produces recommendations. SQLAdvisor was developed for internal use at Meituan-Dianping and is widely deployed there. The company later open-sourced it, and the internal and public versions are kept in sync. Documentation, including a quick-start guide, an architecture overview, release notes, and development guidelines, is available in the project's doc folder. Bugs and feature requests can be reported through GitHub issues. The README is written in Chinese and the documentation links also lead to Chinese-language pages.

Copy-paste prompts

Prompt 1
I have a slow MySQL query: SELECT * FROM orders JOIN users ON orders.user_id = users.id WHERE orders.status = 'pending' GROUP BY users.id. Using SQLAdvisor logic, what indexes should I add to speed this up?
Prompt 2
Explain what a database index is and how SQLAdvisor decides which indexes to recommend for a given SQL query.
Prompt 3
I'm using SQLAdvisor to optimize my MySQL database. Walk me through how to install it and run it against a sample query to get index recommendations.
Prompt 4
What are the most common SQL query patterns that benefit most from indexes, and how would SQLAdvisor detect them?
Open on GitHub → Explain another repo

← meituan-dianping on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.