SQL Query Optimizer
Diagnose and rewrite slow SQL queries with expert-level explanations.
Use case
Analyzing and optimizing SQL queries for better performance
Works best with
Input needed
The SQL query, table schemas (with indexes), approximate row counts, and the database engine (PostgreSQL, MySQL, etc.)
Output format
Optimized query, explanation of changes, index recommendations, and estimated performance impact
Example use
Paste a slow JOIN query across 3 tables. Get back an optimized version using proper indexing, query restructuring, and an EXPLAIN plan analysis showing why the original was slow.
Editor’s Note
Highly reliable for common optimization patterns (missing indexes, N+1 queries, subquery-to-JOIN rewrites). Less reliable for database-specific edge cases and optimizer hints. Always test with EXPLAIN ANALYZE on your actual data — row estimates and cardinality matter.
