Learn VisualLearn DB

Discard Key Ranges at Every Level

A B-tree stores sorted keys in balanced levels. The top of the tree is called the root, and the search follows branches down to a leaf that points to the actual data. For example, searching for id = 4200 follows a single path from the root to the matching leaf. Each branch directs the search to a smaller key range, and all leaves remain at the same depth. After finding the first range key, the scan can continue through neighboring leaves in order.

GOAL

Trace how B-tree branches reduce the search range.

Why does tree height grow slowly as keys are added?