Module 2 · Indexes
Episode 14 Hash Indexes
▶ This video is coming to YouTube soon.
How does a hash index find a row in 2 page reads, and how does it grow without rehashing everything? This episode animates static, extendible and linear hashing, then reads a real Postgres hash index's metapage with pageinspect as it splits one bucket at a time, and shows why BETWEEN can't use it.
Chapters
- 0:00Intro
- 0:15Compute the page, don't search for it
- 0:38Static hashing: fast until the chains grow
- 1:57Extendible hashing: double the directory, not the data
- 3:34Linear hashing: split in order, not where it's full
- 5:24The code: which bucket?
- 5:52The code: split the next bucket
- 6:21Proof: Postgres splits one bucket at a time
- 7:18Proof: = uses the hash, BETWEEN can't
- 8:12Postgres's hash index, precisely
- 8:46Trade-offs
- 9:18Recap
- 9:47Next: LSM Trees