DIY: database index
summary
Yandex runs over two petabytes of Postgres and ~3M requests/sec; this demo shows how to extract GiST to extension by copying GiST code, compiling, installing, creating a cube-backed index, inserting ~1k rows and observing the new index serve queries. It explains required hooks: index handler, input/output, vacuum contract, and why you must use generic WAL for replica replay. It surveys ideas that actually change performance: interpolation search for monotonic keys, cache prefetch and layout tweaks, learned-index tradeoffs, and risks around crash, WAL replay, and vacuum.
AI-written summary · about
chapters (16)
- 0:00Introduction to DIY database index
- 1:16What is an access method
- 3:03Types of access methods
- 5:57Why create custom access methods
- 9:04Motivation and learning benefits
- 12:38Implementing index as extension
- 17:08Demo: Forking GiST extension
- 20:14Write-ahead logging for extensions
- 23:09Vacuum and index contracts
- 24:54Query data types for complex searches
- 26:19Ideas for custom index extensions
- 27:25Learned indexes and adaptations
- 28:51Specialized B-tree optimizations
- 31:46Improving binary search in B-tree
- 33:36Forking B-tree challenges
- 35:27Conclusion and next steps
