Module 16 · Query Optimization · Reference Library Home · Smells · Best Practices · Troubleshooting · Lesson 07
Use this checklist during code review, pre-deployment verification, and quarterly query audits. Each item maps to a specific lesson or reference document.
SELECT * (Lesson 06)%text unless full-text/trigram index exists (Lesson 03)JOIN ... ON — no comma joins without join condition (Lesson 06)NOT IN against nullable subquery columns — use NOT EXISTS (Lesson 05)DISTINCT is not masking a join fan-out — fix the join instead (Lesson 06)OFFSET — keyset/cursor pagination used (Lesson 06)UNION ALL where needed (Lesson 06)WHERE status = 'active')EXPLAIN output — index exists but plan shows a full table scan (Seq Scan in PostgreSQL, type: ALL in MySQL) is a red flagEXPLAIN ANALYZE run against production-representative data volumeBatches > 1 in PostgreSQL hash nodes)ANALYZE / UPDATE STATISTICS run after bulk loads or major data changespg_stat_statements)pg_stat_user_tables.n_dead_tup)SELECT returning millions of rows to applicationstatement_timeout / query timeout prevents runaway queriespg_stat_statements / Query Store capturing top queries by total timeCREATE INDEX CONCURRENTLY (PG) / WITH (ONLINE = ON) (SQL Server)| Score | Meaning | Action |
|---|---|---|
| 90–100% | Production-ready | Ship with confidence |
| 70–89% | Minor gaps | Address flagged items before merge |
| 50–69% | Significant risk | Block merge until plan reviewed |
| < 50% | Not production-ready | Rework query shape before any index work |