SQL Query Plan Visualizer
Understand how your query executes and get optimization tips
SQL Query
📋 Formatted Query
SELECT u.email, u.name, COUNT(p.id) as post_count FROM users u LEFT JOIN posts p ON p.author_id = u.id WHERE u.role_id = 1 AND p.published = true GROUP BY u.email, u.name HAVING COUNT(p.id) > 5 ORDER BY post_count DESC LIMIT 20;
Execution Plan & Analysis
Index lookup on "users". ✅ Uses index for efficient access.
Sorts the result set by the specified column(s). Consider adding an index on the ORDER BY columns to avoid in-memory sort.
Groups rows and computes aggregates (COUNT, SUM, etc.). Ensure grouping columns are indexed for large datasets.
Filters groups after aggregation. Cannot use indexes — applied in-memory.
LEFT join with "posts". Ensure join columns have indexes. Outer joins may scan unmatched rows.
Filters rows: u.role_id = 1 AND p.published = true.... Use indexes on filter columns. Avoid leading wildcards in LIKE.
Selects requested columns for the final output. Only selecting needed columns reduces memory usage.
Restricts the number of output rows. Helps reduce data transfer.
Optimization Tips
About the SQL Query Plan Visualizer
Visualize SQL execution plans step by step. Understand table scans, joins, sorts, and aggregates.
Paste an EXPLAIN plan output to get a visual breakdown of each step. Includes cost estimates and optimization tips.
How to use
- Paste your EXPLAIN output.
- The plan renders as a visual tree.
- Review each step for optimization.