Module 0 · Orientation
Episode 2 The Memory Hierarchy
▶ This video is coming to YouTube soon.
From an L1 cache to a disk seek, access times span eight orders of magnitude. This episode rescales them to human time, races sequential reads against scattered ones on a hard disk and an SSD, explains why databases count 8 KB pages, and shows on a real Postgres where random_page_cost = 4 comes from and how changing it flips a plan.
Chapters
- 0:00Intro
- 0:15The gap every database is built around
- 0:31From an L1 cache to across the ocean
- 1:19If one nanosecond lasted one second
- 1:56The race: in order against scattered
- 3:04Reading 1,000 pages, one at a time
- 3:35Why databases count pages
- 4:16random_page_cost = 4 is a guess about caching
- 5:03Proof: pages, prices, a cold read and a warm one
- 6:37How databases live with the gap
- 7:09Recap
- 7:37Next: Files, Pages and Heap Files