The Runtime Theory
Databases

B-Trees: The Shape of Databases

B-Trees: The Shape of Databases

12:39#b-tree#indexes#storage

A visual explanation of the data structure under PostgreSQL, MySQL, and SQLite. We build a B-tree from first principles — page sizes, fan-out, the leaf chain — and then use EXPLAIN to watch a query planner walk the tree we just built.

Topics covered:

  • Why nodes are sized to disk pages
  • Range scans and the leaf chain
  • Splits, merges, and index bloat
  • Reading your index's health from its statistics

Related articles

Depth, delivered weekly

One technical dispatch a week — articles and episode notes before they go public.

One technical dispatch per week. No noise.