Why Postgres Cache Gets Pricier with Connections: Huge Pages Explained
arpit_bhayani · x · 2026-07-27
Arpit Bhayani explains why PostgreSQL's sharedbuffers cache becomes more expensive as connection counts rise. Because the OS manages memory in default 4 KB pages, each backend process maps the entire shared buffer segment, causing page table entries to scale linearly with connections.
The article notes that enabling Huge Pages (THP, e.g., 2 MB pages) mitigates this. Larger pages drastically reduce page table entries, allowing the TLB (Translation Lookaside Buffer) to cover almost the entire hot working set, bypassing page table lookups during reads. ClickHouse's managed Postgres even pins buffer caches to huge pages and refuses to boot if it fails, preventing silent fallbacks to 4 KB pages.
Related event: Why Postgres Shared Buffers Get Pricier with More Connections(2 posts)→
More from Infra
- fmgo: call Apple's on-device Foundation Models from Go with no CGO and no Swift — Super_Run_8466 · 2026-09-23
- Huawei unveils Peerium architecture: nested BSP unifies million processors into one computer — Dr_Singularity · 2026-09-23
- Grok explains why DeepSeek picked DualPipe + ZeRO-1 over ZeRO-3 on 2048 H800s — TheZachMueller · 2026-09-23
- AI costs fall 47% per quarter, 4x faster than DNA sequencing: Epoch AI — daveholtz · 2026-09-23
- M5 Ultra LLM test: 4x faster prompt processing, but double the power draw — DigitalguyCH · 2026-09-23
- $500 of Dell OptiPlexes become a diskless netboot lab where AI agents can't brick the hardware — colinmcnamara · 2026-09-23