VISUALISERS · PERSISTENCE
B-tree split visualiser
The B-tree answers what actually happens when a page is full?
KEYS
8
PAGES
4
DEPTH
2
SPLITS
2
Every page holds at most three keys. 8 keys have caused 2 splits, and the tree is 2 levels deep — so any key is 2 page reads away, whichever key you ask for.
Every page here holds at most three keys, so splits happen constantly. A real page holds hundreds, which is why a B-tree over a million rows is still only three or four levels deep — and why its read cost is so boringly predictable.
What a split actually does
A page here holds at most three keys. It is one read from disk, so the whole point is to keep it full enough to be worth fetching and small enough to fit.
Insert a fourth key into a full page and it cannot stay one page. The page divides in two, and the middle key does not go into either half — it moves up to the parent, where it becomes the signpost that says which half to descend into. That is the split: two half-full pages below, one new key above.
It is why the tree grows from the root rather than the leaves, and why its depth goes up so rarely. The seeded tree above took eight keys and two splits to reach two levels; the next level costs hundreds more.
Want an explanation to go with the picture? Find a guided starting point →