sql-index-tuning
Diagnose slow SQL queries and add the right indexes without over-indexing — B-tree mechanics, composite ordering (equality-before-range), the leftmost-prefix rule, covering/index-only scans, reading EXPLAIN ANALYZE, selectivity, and write-amplification costs. Worked SQL examples and a runnable index-suggester.
Free & open source (Apache-2.0) — view the source on GitHub.
Overview
Indexing is the highest-leverage performance work in most data-backed systems: the right index turns a multi-second sequential scan into a sub-millisecond lookup, and the wrong one quietly taxes every write forever. This skill is the deep reference for doing it deliberately — how B-tree indexes actually work, how to order composite columns, how to read a query plan, and when an index is the wrong
What it covers
- B-tree basics
- Composite indexes & the leftmost-prefix rule
- Covering indexes & index-only scans
- Reading EXPLAIN / EXPLAIN ANALYZE
- Selectivity & cardinality
- The write-amplification cost — when NOT to add an index
- B-tree Internals