Parameter · Resource Usage / Memory
huge_page_size
The size of huge page that should be requested. 0 means use the system default.
- Default:
0 - Type: integer (kB)
- Range: 0 … max (2147483647)
- Applies: Restart required
In plain words
When huge_pages is used, this picks the page size. 0 means "whatever the operating system's default huge page size is", which is 2 MB on most x86 Linux systems. Some systems also offer 1 GB pages.
For DBAs and operators
Non-zero values are supported only on Linux and must match a size the kernel offers (/sys/kernel/mm/hugepages/), with pages of that size reserved (for 1 GB pages usually at boot via hugepagesz=1G hugepages=N on the kernel command line). shared_memory_size_in_huge_pages is calculated for the configured size.
1 GB pages reduce TLB pressure even further for very large shared_buffers (hundreds of GB), but the segment is rounded up to a whole page and reservation is inflexible. For most systems the default 2 MB pages give nearly all the benefit. Other architectures offer other sizes (for example arm64 with 4 kB base pages: 64 kB, 2 MB, 32 MB, 1 GB); the directory below lists what your kernel supports.
ls /sys/kernel/mm/hugepages/
# hugepages-1048576kB hugepages-2048kB
SHOW shared_memory_size_in_huge_pages;How to change it
Change in postgresql.conf or ALTER SYSTEM, then restart the server.