What problem does it solve?
This Skill helps developers and DBAs identify and fix slow database queries, reduce resource consumption and latency, and eliminate common anti-patterns like N+1 queries that degrade application performance.
Core Features & Use Cases
- EXPLAIN analysis: Interpret query execution plans to reveal sequential scans, index usage, join methods, cost estimates, and actual vs estimated row counts.
- Indexing strategies: Recommend appropriate index types (B-Tree, GIN, GiST, BRIN), composite and functional indexes, partial and covering indexes, and guidance on when to add or remove indexes.
- Query refactors & patterns: Provide rewrites to avoid correlated subqueries, optimize joins, switch to cursor-based pagination, batch operations, and advise on materialized views and partitioning.
- Use Case: Diagnose a high-latency API endpoint by analyzing its EXPLAIN output, producing index and query rewrite recommendations, and outlining maintenance steps (ANALYZE, VACUUM, reindex).
Quick Start
Analyze the provided slow query and its EXPLAIN output, then recommend concrete index, rewrite, and maintenance steps to reduce execution time.