Key Facts
- Category
- Developer & Web
- Input Types
- textarea, select, number
- Output Type
- html
- Sample Coverage
- 4
- API Ready
- Yes
Overview
The SQL Explain Plan Visualizer parses raw EXPLAIN and EXPLAIN ANALYZE outputs from PostgreSQL, MySQL, and SQLite into an interactive, color-coded cost tree. It highlights performance bottlenecks, flags significant discrepancies between estimated and actual row counts, and provides actionable index and query rewrite recommendations.
When to Use
- •When a database query is running slowly and you need to pinpoint the exact node causing the bottleneck.
- •When you suspect stale database statistics are causing the query planner to choose inefficient scan methods.
- •When analyzing complex, nested execution plans that are difficult to read in raw text or JSON formats.
How It Works
- •Paste your raw EXPLAIN or EXPLAIN ANALYZE output (JSON or text format) into the input area.
- •Select your database dialect (PostgreSQL, MySQL, or SQLite) or let the tool auto-detect it.
- •Optionally input the original SQL query to help the visualizer generate precise index recommendations.
- •Analyze the generated tree diagram to identify high-cost nodes, sequential scans, filesorts, and row-estimate divergences.
Use Cases
Examples
1. Diagnosing Stale Statistics in PostgreSQL
Database Administrator- Background
- A user search query on a PostgreSQL database is taking several seconds despite having an index on the email column.
- Problem
- The query planner is choosing a sequential scan over an index scan because it estimates only 1,000 rows, but the table actually returns 95,000 rows.
- How to Use
- Paste the PostgreSQL EXPLAIN ANALYZE JSON output into the tool, set the dialect to PostgreSQL, and input the SQL query.
- Example Config
-
{ "dialect": "postgresql", "sql": "SELECT * FROM users WHERE lower(email) = '[email protected]'", "maxDepth": 20 } - Outcome
- The visualizer highlights the Seq Scan node in red, flags the 95x row divergence, and suggests running ANALYZE to update table statistics.
2. Identifying Filesorts in MySQL Queries
Backend Engineer- Background
- An API endpoint sorting user records by creation date is experiencing high latency under load.
- Problem
- The MySQL execution plan shows a filesort operation, indicating that the database is sorting rows in memory or on disk instead of using an index.
- How to Use
- Run EXPLAIN FORMAT=JSON on the query, paste the JSON output into the visualizer, and select MySQL as the dialect.
- Example Config
-
{ "dialect": "mysql", "maxDepth": 15 } - Outcome
- The tool displays a cost tree highlighting the filesort node and recommends creating a composite index on the filtered and sorted columns.
Try with Samples
json, sql, textRelated Hubs
FAQ
Which database dialects and formats are supported?
The tool supports PostgreSQL (JSON and text), MySQL (JSON and tabular), and SQLite (QUERY PLAN text).
How does the tool identify stale database statistics?
It compares the estimated plan rows with the actual rows from EXPLAIN ANALYZE; a difference of 10x or more flags a statistics hotspot.
Do I need to provide the original SQL query?
No, the SQL query is optional, but providing it allows the tool to suggest specific index columns and query rewrites.
What types of query bottlenecks are flagged?
It flags sequential scans on large tables, filesorts, temporary tables, expensive nested loops, and non-sargable predicates.
Is my query plan data sent to an external server?
No, all parsing and visualization are performed locally in your browser to ensure data privacy.