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
- China pours billions into optical chips for AI data centers despite US curbs threat — pstAsiatech · 2026-12-02
- Air New Zealand to roll out free Starlink-powered inflight Wi-Fi starting 2027 — elonmusk · 2026-12-02
- Nvidia B300 claimed 5-6x more efficient than China GPUs, but revenue gap is only ~3x — teortaxesTex · 2026-12-02
- Crucible Capital: capital intensity is the moat of the AI infrastructure era — AccBalanced · 2026-12-02
- Startup unveils 8192-core CPU, arguing the ASIC-vs-CPU gap is only 10x — AccBalanced · 2026-12-02
- vLLM's 4-bit KV cache runs 1.7× slower than FP8; new Hopper kernel fixes it — AccBalanced · 2026-12-02