6 February 2026
CERN
Europe/Zurich timezone
There is a live webcast for this event.

The Alchemy of Shared Buffers: Balancing Concurrency and Performance

6 Feb 2026, 15:25
45m
503/1-001 - Council Chamber (CERN)

503/1-001 - Council Chamber

CERN

162
Show room on map
Day 1

Speaker

Josef Machytka

Description

Talk dissects PostgreSQL’s shared buffers: the three‑layer design (buffer pool → BufferDesc headers → buf_table hash), the hit/miss/I‑O lifecycle, and how pins, per‑page LWLocks, and atomic BM_* flags coordinate page‑granular concurrency. We will trace clock‑sweep and buffer rings that prevent big scans and VACUUM from polluting the cache, then follow WAL‑before‑data through bgwriter and the checkpointer to show how writes are made smoother. We will also discuss tuning and what’s new in PG 17 (vectored reads), and PG 18 (async reads) and what can come next - we will dive into new design proposals discussed in 2025 - to allow dynamic resize of shared_buffers via segmented shared memory.

Key takeaways
- Architecture & locks: three layers; pins + per‑page LWLocks + partitioned mapping yield high concurrency
- Replacement & pollution control: clock‑sweep keeps hot pages; buffer rings fence off bulk scans and VACUUM
- Durability & flushing: WAL‑before‑data with bgwriter/checkpointer turns random writes into managed I/O
- Tuning: balance double buffering, size shared_buffers sensibly, smooth checkpoints, and verify with EXPLAIN (BUFFERS) and pg_stat_bgwriter
- Roadmap: PG 18’s async reads cut scan latency; dynamic shared_buffers resizing is being prototyped

Author

Presentation materials