Caffeinated Coder
Book an appointment
Lesson 13 · Inside a database

B-trees

Without an index, finding one row means reading every page of the table. A B-tree index keeps the keys sorted in a tree of pages, so the database reads one page per level instead. Follow CREATE INDEX on a small books table, a search for id 28, a range scan along the linked leaves, and an insert that fills a page, splits it and copies a separator key up to the root.

14 min11 steps5 questionsAdvanced
Fig 13 · Interactive
Loading figure…
or ← →

Quiz Unlocks after the last step.