What problem does it solve?
This Skill helps you diagnose and fix slow database queries by guiding you through query-plan reading, index design, and common SQL performance anti-patterns.
Core Features & Use Cases
- EXPLAIN-first tuning: Learn to interpret PostgreSQL EXPLAIN / EXPLAIN ANALYZE metrics to pinpoint where time is spent.
- Index strategy recipes: Choose appropriate index types (B-Tree, GIN, GiST, BRIN), craft composite and partial indexes, and use expression/covering indexes for real speedups.
- Optimization patterns: Apply proven fixes for N+1 query issues, inefficient pagination (OFFSET vs cursor), expensive COUNT/GROUP BY patterns, and correlated subquery rewrites, including batching and aggregation techniques.
- Advanced performance levers: Improve performance with materialized views and partitioning, plus selective tuning techniques like join-method guidance and maintenance practices.
Quick Start
Use sql-optimization-patterns to analyze the slow query and generate the most likely index and rewrite changes based on its EXPLAIN ANALYZE output.