B-Tree (Index Database) Playground

Each node holds many keys; when full → SPLIT, and one key rises to the parent (which one?). It grows UPWARD, always balanced. Toggle order, search, height =…

Why it matters

On disk, opening a node means reading a block, and that is slow. A binary tree has one key a node, so it is log₂ n high; a B-tree holds hundreds of keys a node, so millions of rows fit in three or four levels. Postgres, MySQL InnoDB and SQLite use the B+tree variant.

The key idea

Wide nodes, a short tree, growing at the top

Common mistakes

Try it in this playground