Module 2 · Indexes
Episode 13 Concurrent B+ Trees
▶ This video is coming to YouTube soon.
How do hundreds of queries share one B+ tree without corrupting it or missing keys? Locks vs latches, the race that loses a key, latch crabbing, optimistic descent, and Lehman and Yao's B-link tree, then proof from Postgres's own pages: high keys, right-links, and locks that never touch a page.
Chapters
- 0:00Intro
- 0:16A key that's there, not found
- 0:34Locks are not latches
- 1:13The race: a split under a reader
- 2:00Latch crabbing: readers
- 2:48Writers: hold until it's safe
- 3:49Optimistic: bet on no split
- 4:43The code: crabbing an insert
- 5:11B-link trees: move right
- 6:25The code: move right
- 6:51Proof: Postgres pages carry high keys
- 7:58Proof: locks last, latches don't
- 8:52Trade-offs
- 9:21Recap
- 9:50Next: Hash Indexes