Module 1 · Storage
Episode 8 Replacement Policies
▶ This video is coming to YouTube soon.
Which page should a full buffer pool evict? This episode runs FIFO, LRU, Clock and LRU-K on the same requests, shows one sequential scan flushing an LRU cache, and then opens up Postgres: usage counts from 0 to 5, a sweeping clock hand, and the 32-frame ring that keeps a 46 MB scan from flooding shared buffers.
Chapters
- 0:00Intro
- 0:15One scan, and the cache is gone
- 0:34FIFO throws out the hottest page
- 1:12LRU: evict the least recently used
- 1:48Clock: one bit instead of a list
- 2:44Sequential flooding
- 3:33LRU-K: count the second-to-last use
- 4:21One workload, every policy
- 4:59Postgres: the clock sweep
- 5:57Postgres: a ring for big scans
- 6:46The code: clock sweep
- 7:14Proof: usage counts stop at 5
- 7:39Proof: a 46 MB scan through 32 frames
- 8:28Trade-offs
- 9:03Recap
- 9:32Next: Lab: I Deleted Half the Table and It Got Bigger