TFT

SQL Execution Plan Visualizer & EXPLAIN Tool

Visualize your SQL query's execution plan to understand performance. Upload EXPLAIN output or paste a query to see a flowchart of scans, joins, and sorts for optimization.

SQL Execution Plan Visualizer

Visualize and analyze SQL query execution plans

How It Works

This SQL execution plan visualizer transforms database EXPLAIN output into visual flowcharts that show how your queries are executed, helping you identify performance bottlenecks.

The visualization process:

  1. EXPLAIN output input: Paste the output from EXPLAIN, EXPLAIN ANALYZE, or query plan commands from your database.
  2. Plan parsing: The tool extracts operation types (scan, join, sort), estimated costs, row counts, and access methods.
  3. Visual mapping: Operations are converted to nodes in a flowchart, with arrows showing data flow from tables to final result.
  4. Performance highlighting: Expensive operations (full table scans, large sorts, nested loops) are visually emphasized for quick identification.

Understanding execution plans is essential for query optimization. Visual representation makes it easier to spot inefficient operations that slow down your queries.

When You'd Actually Use This

Slow Query Investigation

Diagnose why a specific query is taking seconds or minutes instead of milliseconds.

Index Effectiveness Review

Verify that your indexes are actually being used instead of full table scans.

Join Optimization

See which join algorithm is chosen (nested loop, hash join, merge join) and whether it's appropriate.

Query Refactoring Validation

Compare execution plans before and after query changes to confirm improvements.

Database Tuning

Identify queries that would benefit from statistics updates, index creation, or query rewrites.

Learning Query Optimization

Students and junior developers can visually understand how databases execute queries.

What to Know Before Using

EXPLAIN format varies by database

MySQL, PostgreSQL, SQL Server, and Oracle all have different EXPLAIN output formats. This tool supports the most common formats.

Estimated vs actual plans differ

EXPLAIN shows estimated costs. EXPLAIN ANALYZE shows actual runtime. Both are useful - estimates for planning, actual for debugging.

Plans depend on statistics

Outdated table statistics lead to suboptimal plans. Run ANALYZE or UPDATE STATISTICS regularly for accurate plans.

Visual complexity grows with query complexity

Simple queries produce clean diagrams. Complex queries with many joins may produce dense visualizations that require careful study.

Some operations are database-specific

Proprietary operations (Oracle's CONNECT BY, PostgreSQL's GIN scans) may display generically without database-specific explanations.

Common Questions

How do I get EXPLAIN output from my database?

Prefix your query with EXPLAIN (MySQL/PostgreSQL) or SET SHOWPLAN_TEXT ON (SQL Server). For actual runtime, use EXPLAIN ANALYZE in PostgreSQL or enable actual execution plan in SSMS.

What's the most important thing to look for?

Full table scans on large tables are usually the biggest problem. Look for Seq Scan (PostgreSQL) or TABLE SCAN (SQL Server) on tables with millions of rows.

What does a good execution plan look like?

Index scans instead of table scans, appropriate join types for data sizes, sorts on indexed columns, and low estimated costs relative to result size.

Why does the optimizer choose a nested loop join?

Nested loops are efficient for small datasets or when one side is very selective. For large tables, hash joins or merge joins are usually better.

Can I force a different execution plan?

Yes, using query hints (FORCE INDEX, OPTION HASH JOIN) or by rewriting the query. But understand why the optimizer chose the original plan first.

What are the numbers in the plan?

Cost estimates show relative expense. Row estimates show expected rows at each step. Actual rows (from ANALYZE) show what really happened. Compare estimates to actuals.

How do I share execution plans with my team?

Export the visualization as an image or share the EXPLAIN output text. Many teams include execution plans in performance review documentation.