High-concurrency distributed snapshots
summary
Current MVCC snapshots rely on a shared-memory proc array and get_snapshot_data that becomes an N² scalability bottleneck as CPUs and concurrent transactions grow; subtransaction tracking is limited to 64 entries and forces expensive top-level lookups, and mixing synchronous_commit modes creates different commit orders on primary and standby and even lost commits on failover. Proposal: assign a monotonic commit sequence number (CSN) (counter, LSN, or hybrid wall-clock) recorded in an SLRU or ring buffer, batch-convert old CSNs to pg_xact bits, and use CSN-based snapshot checks — patches exist aiming for integration around Postgres 18.
AI-written summary · about
chapters (5)
- 0:00Introduction
- 1:00Database concurrency concepts
- 11:11Current snapshot implementation
- 24:17Proposal for CSN snapshots
- 43:22Optimization and future work
related talks
48mLightning Talks
27mImplementing Strict Serializability with pg_xact
49mConcurrency Deep-Dive
47mA Batch of Commit Batching
45mTransactions and Concurrency Control Patterns
18mAvoiding Conflicts in Highly-Concurrent Applications
28mUnderstanding Transaction Isolation for App Developers
41mTransactions: myths, surprises and opportunities
