What problem does it solve? Slow SQL queries degrade application performance, and diagnosing them requires expertise in reading EXPLAIN plans, choosing indexes, and rewriting queries. This Skill provides a structured workflow for identifying bottlenecks and applying proven optimizations. ## Core Features & Use Cases - EXPLAIN Plan Analysis: Interpret query execution plans to spot sequential scans, missing indexes, and expensive joins. - Index Recommendations: Create single-column, composite, covering, and functional indexes matched to query patterns. - Query Rewrites: Replace SELECT *, IN subqueries, and functions on indexed columns with faster equivalents. - Benchmarking & Detection: Measure before/after performance with TypeScript scripts and detect slow queries via pg_stat_statements. - Use Case: A dashboard endpoint takes 250ms because of a sequential scan on the orders table; use this Skill to add an index on user_id and cut execution time to under 1ms. ## Quick Start Analyze this slow PostgreSQL query with EXPLAIN ANALYZE and recommend indexes and rewrites to improve its performance.