Experimenting with a Global Index in PostgreSQL: Design, Implementation, and Challenges
summary
A working patch implements a prototype global index in PostgreSQL using the same B-tree structure, adds a unique partition identifier mapping stored in pg_index_partition, and rewrites global indexes on attach while detaching simply invalidates IDs so old entries are ignored. Tests with ~1,000 partitions of 50,000 tuples each show index-only scans become far faster but VACUUM time jumps from ~15 seconds to ~45 minutes, exposing the need for a multi‑phase or decoupled heap/index vacuum (dead‑tid store) and scheduler work; code is on the hackers list.
AI-written summary · about
chapters (12)
- 0:00Introduction and background
- 2:56Why global indexes are needed
- 5:46High-level design goals
- 7:11Storage design for global indexes
- 10:23Partition identifier challenges
- 14:39Attaching and detaching partitions
- 17:07Global index scan mechanics
- 20:24Design challenges with vacuuming
- 23:15Solutions for vacuuming global indexes
- 28:29Decoupling heap and index vacuum
- 31:19DDL and index rewriting issues
- 32:44Key takeaways and future work
related talks
41mGlobal unique index a different approach
45mA Deep Dive into PostgreSQL Indexing
52mA Deep Dive into PostgreSQL Indexing
53mAdvanced Indexing Techniques in PostgreSQL
31mPostgres Partitioning Best Practices
52mPostgreSQL Index Strategy Guide
37mRules of Indexing in PostgreSQL
49mFlexible Indexing with Postgres
