Manuals / SQL / Chapter 10
D · Performance · advanced · Week 3–4 · Chapter 10 of 12
Indexes & EXPLAIN
Indexes speed reads, slow writes. B-tree default. EXPLAIN shows query plan. Index columns in WHERE and JOIN.
Why indexes
Without index: full table scan. With index on customer_id: fast lookup for JOINs and WHERE customer_id = ?.
Why indexesDrag stickies · tap for tips
Do this now
Read Use The Index, Luke — chapter 1. Note one insight.
Was this step clear?
Chapter learning outcomes
- CREATE INDEX
- EXPLAIN / EXPLAIN ANALYZE
- When to index
- Covering indexes lite
Clear these before you leave
Side quest
Composite index
Index (status, created_at) for WHERE status=? ORDER BY created_at.