What problem does it solve?
This Skill helps developers and DBAs diagnose and fix slow SQL queries by establishing performance baselines, analyzing execution plans, and guiding iterative rewrites that reduce latency and resource usage while preserving correctness.
Core Features & Use Cases
- Performance baselining: Measure cold and warm execution times across multiple runs and establish clear success criteria.
- Query plan analysis: Interpret EXPLAIN / EXPLAIN ANALYZE output to identify full table scans, correlated subqueries, materialization, and costly sorts or joins.
- Optimization techniques: Recommend and compare multiple approaches such as CTEs, window functions, join reordering, subquery-to-join rewrites, and indexing strategies with database-specific considerations for SQLite, PostgreSQL, and MySQL.
- Verification & benchmarking: Validate correctness with full-result comparisons, checksums, or row counts and measure improvements using repeatable multi-run benchmarks (cold vs warm cache).
- Iterative refinement: Propose 2–3 alternatives, benchmark each, and document the rationale behind the chosen solution.
Quick Start
Analyze the query's execution plan, propose two alternative rewrites, and benchmark their median execution times to choose the best performing, correct solution.