Curriculum · Module 07, Storage Engines
B-trees and page writes
Why a tree of pages keeps lookups short, what an insert costs when a page splits, and how a write-ahead log lets the engine put off writing pages.
What each topic covers
- Why a database stores sorted keys in wide pages, and why a tall, thin tree would make every lookup slow.
- How a lookup picks one child per level, and how an insert into a full page splits it and may grow the tree.
- Watch pages split, then compare random keys, ascending keys and a tree with no log.
- Write amplification in a B-tree comes from writing a page for a record, and random keys make it worse.
- A write-ahead log turns a random page write into an append, so the engine can write dirty pages later and in batches.
- A checkpoint writes the dirty pages. Rare checkpoints write fewer pages and make recovery longer.
- Three quick checks on tree height, page splits and the log, with the sources behind the lesson.
Topics
Practise this lesson
8 interview questions on b-trees, with worked answers and sources.
Your progress is saved in this browser. Sign in to keep it on every device. Privacy · Terms