Query plan inspection
SQL Execution Plan Visualizer
Paste a PostgreSQL or MySQL EXPLAIN plan to view its execution tree and inspect source-reported metrics. Plans are parsed entirely in your browser and are not uploaded.
Parsed entirely in your browser — nothing is uploaded.
Plan source
PostgreSQL textInterpretation
Optimizer cost is source-reported and not time.Execution tree
How to use the visualizer
- Paste PostgreSQL text or JSON, or MySQL TREE text, into the EXPLAIN / EXPLAIN ANALYZE input.
- Select Analyze plan.
- Expand or collapse the execution tree, select a node, inspect its metrics, and review any next action or copyable SQL example.
How the calculations work
The visualizer keeps optimizer cost separate from execution time. When both startup and total cost are parsed, it calculates:
cost span = max(0, estimated total cost − estimated startup cost)
Cost stays source-reported. It is not converted to milliseconds and is not used for cross-database comparisons.
For ANALYZE output, the tool calculates total observed rows from the parsed per-loop value and loop count:
actual rows total = actual rows per loop × loops
When estimated rows are greater than zero, it calculates the row estimate ratio:
row estimate ratio = actual rows total ÷ estimated rows
The signed estimate error is:
row estimate error = (row estimate ratio − 1) × 100%
A node receives estimate-mismatch hotspot treatment when its ratio is at least 5 or at most 0.2. This is a visual heuristic, not proof of a database problem. When actual start and end times are available, the tool displays:
reported execution time span = max(0, actual end time − actual start time)
Plain EXPLAIN output shows estimates only. Missing actual fields remain unavailable; the tool does not invent actual rows, loops, or timing.
FAQ
What is an SQL execution plan, and how do I read it?
An SQL execution plan is the database’s selected sequence of operations, such as scans and joins. Paste it to view the hierarchy, select individual nodes, and inspect the metrics parsed from the source output.
What is the difference between EXPLAIN and EXPLAIN ANALYZE?
EXPLAIN reports optimizer estimates. EXPLAIN ANALYZE executes the statement and can report observed rows, loops, and timing fields. Use ANALYZE output when you need an estimate-versus-actual comparison, with the same execution precautions you use in your database environment.
How do I visualize a PostgreSQL EXPLAIN ANALYZE plan?
Paste PostgreSQL text EXPLAIN ANALYZE output and select Analyze plan. The tool detects PostgreSQL text, builds an interactive tree, and displays actual rows per loop, loops, total observed rows, row ratio, signed row error, and reported execution-time span when those fields are present. PostgreSQL plan JSON is also supported.
Can I paste MySQL EXPLAIN FORMAT=TREE output?
Yes. The implementation recognizes MySQL TREE-style text plans containing -> operators and cost or row metrics, and labels the source MySQL TREE. PostgreSQL plan JSON is supported separately; use text mode for MySQL plans in this tool.
Why are estimated rows different from actual rows?
Optimizer estimates can differ because of data distribution, stale statistics, skew, correlated predicates, or join conditions. For a flagged mismatch, review statistics, data distribution, join predicates, and indexes on relevant join keys before changing the query.
Are PostgreSQL and MySQL cost values measured in milliseconds?
No. Cost is displayed as source-reported optimizer cost. The tool does not convert cost to milliseconds or compare raw PostgreSQL and MySQL cost values. Timing is shown separately as a reported execution time span when ANALYZE timing fields are available.
How can I find the most expensive or mismatched plan node?
Select nodes in the execution tree and inspect their metrics. Estimate-mismatch hotspot treatment is applied when a node’s row ratio is at least 5 or at most 0.2. The tool does not calculate a separate whole-tree runtime total.
Can the visualizer suggest statistics refreshes, indexes, or join-strategy checks?
For a root node flagged as an estimate mismatch, it provides an investigation card covering statistics, data skew, join predicates, and join-key indexes. It can supply a copyable ANALYZE; example and asks you to verify by running EXPLAIN ANALYZE. It does not generate a column-specific CREATE INDEX statement or force a join order.
Trust and privacy
Parsing happens entirely in your browser. The pasted plan is not uploaded by this tool. Review any generated SQL example before running it.