What problem does it solve? Slow database queries degrade application performance, and fixing them without a systematic approach leads to guesswork. This Skill provides a structured method to diagnose slow queries using EXPLAIN ANALYZE, apply the right index strategies, and measure concrete before/after improvements. ## Core Features & Use Cases - Anti-Pattern Detection: Identifies and fixes common issues like missing indexes, SELECT *, N+1 queries, OR conditions, functions on indexed columns, and leading-wildcard LIKE searches. - Index Strategy Design: Covers composite, covering, partial, and expression indexes with correct column ordering rules. - Query Rewriting & Execution Plans: Rewrites subqueries as JOINs, limits before joins, reads EXPLAIN ANALYZE output, and uses materialized views or partitioning for large tables. - Use Case: A PostgreSQL orders table with 5M rows takes 8.5 seconds per lookup. The Skill diagnoses a sequential scan, adds a composite index, rewrites the query, and verifies the drop to 45 milliseconds. ## Quick Start Analyze this slow PostgreSQL query on my orders table and recommend indexes and a rewritten version with before/after EXPLAIN ANALYZE results.