Experimenting with a Global Index in PostgreSQL
summary
Experimental global indexes store a partition identifier as last key column so B-tree deduplication and suffix truncation work without changing on-disk format, and a new PG_index_partition mapping gives each global-index+leaf pair a unique id that is invalidated on detach to allow fast drops. Attaching currently rewrites the global index; scans convert partition id to relation id via a cached map. Vacuuming is the biggest problem — with 1,000 partitions of 50k rows each time rises from 15 seconds → 45 minutes — solutions: aggregate dead-TIDs and vacuum the global index once or fully decouple heap and index vacuum; locking on leaf-level DML remains unresolved.
AI-written summary · about
chapters (10)
- 0:00Introduction and speaker intro
- 1:51Use case for global index
- 5:02Design goals for implementation
- 6:50Global index storage design
- 12:30Partition identifier challenges
- 19:52Attaching and detaching partitions
- 23:22Global index scan and optimization
- 33:35Vacuum challenges and solutions
- 44:18Summary and open challenges
- 45:26Q&A session
