What problem does it solve? Slow SQL queries waste engineering time and degrade application performance, and guessing at fixes (adding random indexes, trusting dev-database timings) rarely works. This Skill provides a disciplined workflow that reads actual execution plans to find where time really goes before changing anything. ## Core Features & Use Cases - Execution plan analysis: Run EXPLAIN (ANALYZE, BUFFERS) at production scale and read the three classic signals — row estimate drift, the node where actual time concentrates, and sequential scans under selective filters. - Index strategy: Design composite indexes in the correct column order, use covering and partial indexes, and verify the planner actually adopts them with a re-EXPLAIN. - Antipattern rewrites: Fix non-sargable predicates (function-wrapped columns, type mismatches, leading-wildcard LIKE), N+1 ORM patterns, OFFSET pagination, and DISTINCT band-aids hiding fan-out joins. - Use Case: A dashboard query timing out at 30 seconds gets diagnosed via EXPLAIN ANALYZE revealing stale statistics and a DATE() wrapper blocking an existing index; after an ANALYZE and a range-predicate rewrite it runs in 90ms with no new index. ## Quick Start Ask the agent to analyze why your slow Postgres query is timing out by running EXPLAIN ANALYZE and recommending index or rewrite fixes.