← ClaudeAtlas

sql-optimizelisted

Use when a SQL query or migration is slow and you need to find the bottleneck and propose indexes or rewrites that make it fast.
NSBen/skillfoundry · ★ 1 · AI & Automation · score 73
Install: claude install-skill NSBen/skillfoundry
# SQL Optimize ## When to use Invoke this skill for slow queries, missing indexes, full table scans, or N+1 patterns in reports and APIs. ## Steps 1. Get the query plan (`EXPLAIN ANALYZE`) and locate the most expensive node. 2. Check whether filters and joins use indexed columns. 3. Propose covering indexes or a query rewrite (join order, CTEs, pagination). 4. Flag N+1 loops that should become a single batched query. 5. Give the before/after plan and the expected impact, with a migration. ## Examples - "Why is this JOIN so slow?" - "Suggest indexes for this report query" ## References Always confirm with EXPLAIN on real data; an index that is never selective can hurt writes more than it helps reads.