SQL EXPLAIN Visualizer

Visualize PostgreSQL and MySQL execution plans. Identify bottlenecks with color-coded interactive trees.

Execution Time
Planning Time
Bottleneck
Warnings

Node Statistics (sorted by time)

Node Type Table Actual Time % of Total Rows Loops
Sponsored

What is EXPLAIN ANALYZE?

EXPLAIN ANALYZE shows how a database executes a query — the execution plan. It reveals which indexes are used, how tables are joined, how many rows are scanned, and how long each step takes. This tool visualizes that plan as an interactive tree, making it easy to spot slow operations that need optimization.

How to Use

Run EXPLAIN ANALYZE on your slow query in PostgreSQL or MySQL. Copy the output and paste it here. The tool will auto-detect the format (text or JSON) and visualize the execution plan. Hot colors (red, orange) indicate expensive operations. Click nodes to see detailed statistics. Look for sequential scans on large tables, nested loops with high row counts, or nodes taking a large percentage of total time.

PostgreSQL

For best results, use: EXPLAIN (ANALYZE, BUFFERS, FORMAT TEXT) SELECT ... or EXPLAIN (ANALYZE, BUFFERS, FORMAT JSON) SELECT .... The BUFFERS option shows cache hit rates. ANALYZE actually runs the query and returns real execution times (be careful with INSERT/UPDATE/DELETE!).

MySQL

Use: EXPLAIN SELECT ... for basic info or EXPLAIN FORMAT=JSON SELECT ... for detailed costs. MySQL EXPLAIN doesn't show actual execution times by default — it only shows estimates. For real timing, use EXPLAIN ANALYZE in MySQL 8.0.18+.

Common Bottlenecks

Sequential Scans: Full table scans when an index could be used. Add an index on filter columns. Nested Loops with High Rows: Can be exponentially slow. Consider hash joins instead. Sorts on Large Datasets: Memory spills to disk. Increase work_mem or reduce rows before sorting. Bad Estimates: Planner chose wrong plan due to outdated statistics. Run ANALYZE on tables.

Color Coding

Nodes are colored by time spent (as % of total): Red (60%+): Major bottleneck. Orange (30-60%): Significant time. Yellow (10-30%): Moderate impact. Green/Gray (0-10%): Negligible cost. Focus optimization efforts on red and orange nodes first.

Related Tools