sql-optimization-patterns
Installation
SKILL.md
Iron Law
PROFILE BEFORE OPTIMIZING — RUN EXPLAIN (ANALYZE, BUFFERS) ON THE ACTUAL SLOW QUERY BEFORE WRITING A SINGLE INDEX
When to Use This Skill
- Debugging slow-running queries in PostgreSQL
- Endpoint response times exceeding target SLA
- Designing performant database schemas for high-traffic tables
- Reducing database load and infrastructure costs
- Resolving N+1 query problems from ORM usage (SQLAlchemy, Prisma, R2DBC)
- Analyzing EXPLAIN query plans from production
- Implementing efficient composite and partial indexes
- Migrating from OFFSET pagination to cursor-based pagination
Do Not Use This Skill When
- You need cloud-native SQL or analytics platforms (BigQuery, Snowflake) — use
sql-pro - You need schema migration design — use
database-schema-designer - The database is not PostgreSQL (patterns are PostgreSQL-specific)