Here’s something interesting… Postgres’s shared_buffers cache gets more expensive with every connection you open, and it is because of how the OS manages memory pages…
The OS hands out memory in 4 KB pages by default, and each backend process maps the entire shared_buffers segment through its own page tables. More connections -> more copies of that mapping, so the number of page table entries scales linearly with the connection count.
Huge pages (THP) help here because they increase the page size far beyond 4 KB. With a 2 MB page, each page table entry covers much more memory than a 4 KB page, so the number of page table entries shrinks, and the TLB (Translation Lookaside Buffer) can now cover almost the entire hot working set.
This way, reads do not need to go to the page table because the required entries are found in the TLB.
This is why even ClickHouse Managed Postgres pins every server’s buffer cache to huge pages. In fact, it actually refuses to boot rather than silently falling back to 4 KB pages.