What problem does it solve?
This Skill tackles slow database queries, high latency, and inefficient schema patterns by providing systematic guidance to diagnose performance bottlenecks and apply proven optimizations.
Core Features & Use Cases
- EXPLAIN plan analysis: Interpret execution plans to identify sequential scans, costly joins, and index usage issues.
- Indexing strategies: Recommend B-Tree, GIN, GiST, BRIN, functional, partial, and covering indexes tailored to query patterns.
- Query refactors & patterns: Eliminate N+1 problems, convert correlated subqueries, optimize pagination with cursors, and suggest batch operations.
- Advanced techniques: Advise on materialized views, partitioning strategies, and operational maintenance (VACUUM, ANALYZE, reindexing).
- Use Case: Improve a reporting query that scans large tables by adding appropriate indexes, rewriting joins, and suggesting partitioning or materialized views for repeated reports.
Quick Start
Analyze the provided slow PostgreSQL query and EXPLAIN ANALYZE output and return a rewritten query, recommended indexes and partitioning options, and an explanation of expected performance improvements.