# The Alchemy of Shared Buffers: Balancing Concurrency and Performance

- Institution: CERN
- Speaker: Josef Machytka
- Year: 2026
- Language: English
- Source: [CERN](https://videos.cern.ch/record/3020779)
- Licence: [CERN](https://copyright.web.cern)
- Who can watch: Teens profiles and older (sources give no ratings; placed by Invisible Network from the source's own words)

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

0:00:00 Slide 1

0:02:01 Slide 2

0:02:24 Slide 3

0:02:47 Slide 4

0:03:33 Slide 5

0:04:28 Slide 6

0:05:40 Slide 7

0:07:28 Slide 8

0:08:36 Slide 9

0:09:57 Slide 10

0:11:32 Slide 11

0:13:42 Slide 12

0:15:06 Slide 13

0:16:49 Slide 14

0:18:11 Slide 15

0:19:45 Slide 16

0:20:55 Slide 17

0:22:57 Slide 18

0:24:51 Slide 19

0:26:33 Slide 20

0:29:14 Slide 21

0:31:30 Slide 22

0:32:07 Slide 23

0:35:12 Slide 24

0:36:37 Slide 25

0:36:51 Slide 26

0:39:25 Slide 27

0:40:11 Slide 28

0:40:29 Slide 29

0:41:39 Slide 30

0:43:14 Slide 31

0:44:28 Slide 32

0:46:04 Slide 33

0:46:38 Slide 34

0:46:49 Slide 35

0:47:06 Slide 36

0:48:01 Slide 37r>

## Lectures

1. [The Alchemy of Shared Buffers: Balancing Concurrency and Performance](https://invisiblenetwork.ai/learn/cern/3020779/6d6700431fb2), 50 min (CERN's player)
