Master SQL query optimization, indexing strategies, and EXPLAIN analysis to dramatically improve database performance and eliminate slow queries. Use when debugging slow queries, designing database schemas, or optimizing application performance.
81
62%
Does it follow best practices?
Impact
94%
1.00xAverage score across 6 eval scenarios
Passed
No known issues
Optimize this skill with Tessl
npx tessl skill review --optimize ./plugins/developer-essentials/skills/sql-optimization-patterns/SKILL.mdN+1 elimination and subquery optimization
No loop queries
100%
100%
Single aggregate query
100%
100%
No correlated subquery
100%
100%
No SELECT *
100%
100%
JOIN-based aggregation
100%
100%
Filter before aggregation
100%
100%
Correct aggregation
100%
100%
CTE or subquery clarity
0%
0%
Notes explain N+1
100%
100%
Notes explain fix
100%
100%
Index design and selection strategy
GIN full-text index
100%
100%
GIN JSONB index
100%
100%
Expression index for email
100%
100%
Partial index for published status
100%
100%
Composite index column order
100%
100%
Cursor pagination index
70%
70%
Cursor-based query provided
100%
100%
No leading wildcard LIKE
100%
100%
Index type rationale
100%
100%
Selective indexing awareness
100%
70%
Performance audit and advanced optimization
pg_stat_statements query
100%
100%
Missing index detection
70%
100%
Unused index detection
100%
100%
Materialized view creation
100%
100%
Concurrent materialized refresh
100%
100%
Batch UPDATE not loop
100%
100%
Temp table for large batch
100%
100%
pg_class approximate count
100%
100%
VACUUM ANALYZE maintenance
75%
100%
Materialized view index
100%
100%
EXPLAIN plan analysis and interpretation
Full EXPLAIN flags
100%
100%
Seq Scan as slow signal
100%
100%
Index Only Scan as best
62%
100%
Join method discussion
50%
50%
Cost field interpretation
100%
100%
Actual time interpretation
100%
100%
Rows estimate vs actual
100%
100%
Expression index recommendation
100%
100%
JOIN aggregation recommendation
100%
100%
Cursor pagination recommendation
100%
100%
Table partitioning and bulk INSERT operations
PARTITION BY RANGE syntax
100%
100%
Partition OF syntax
100%
100%
Four Q1-Q4 partitions
100%
100%
Single batch INSERT
100%
100%
No SELECT * in inserts
100%
100%
Batch UPDATE with IN clause
100%
100%
No per-row update loop
100%
100%
Partition pruning explanation
100%
100%
COPY mention for large data
0%
0%
OR conditions, implicit type conversion, and covering indexes
Fix implicit type conversion
100%
100%
Index for account_number
100%
100%
OR condition diagnosis
100%
100%
OR rewritten with UNION
100%
100%
Explicit JOIN syntax
100%
100%
Covering index for fraud query
100%
100%
Composite index column order for Query 4
100%
40%
Index for billing aggregation
100%
100%
Type conversion explanation
100%
100%
No SELECT * in rewrites
100%
100%
70444e5
Table of Contents
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.