B+Tree Visualizer
The B+tree is what almost every relational database actually uses. The internal nodes are a pure directory — no data — and all the rows live in the leaves, which are linked left to right. So a range scan is one clean sweep.
How a B+tree works
A B+tree splits the job in two. The internal nodes hold only keys, acting as a directory that routes you downward; all the row data lives in the leaf nodes. The leaves are then chained together like a linked list in sorted order. So a point lookup always walks the full height to a leaf, and — the payoff — a range scan lands in the first leaf and then just follows the leaf links along, in order, without ever climbing back up.
Why it beats a plain B-tree for ranges
- id = 30 is found in a leaf, not the root — the internal nodes carry no data. Every point lookup is the same depth: predictable.
- The range scan sweeps leaf → leaf → leaf in one direction. Compare the plain B-tree, which bounces back up to the parent between children.
For the full write-up, see MySQL Internals.