Reports the number of huge pages that are needed for the main shared memory area based on the specified huge_page_size.
At a glance
| Property | Value |
|---|---|
| Parameter | shared_memory_size_in_huge_pages |
| Category | Preset Options |
| Default | (see documentation) |
| Value type | integer |
| Change scope | Per-session (SET) |
| Available in | PostgreSQL 15, 16, 17, 18, 19 (added in 15) |
What it does
Reports the number of huge pages that are needed for the main shared memory area based on the specified huge_page_size. If huge pages are not supported, this will be -1.
This setting is supported only on Linux. It is always set to -1 on other platforms. For more details about using huge pages on Linux, see linux_huge_pages.
(Description quoted from the official PostgreSQL documentation.)
How to apply a change
Can be set per session with SET, per role/database with ALTER ROLE/DATABASE ... SET, or globally in postgresql.conf.
Inspect the current value and source with SHOW shared_memory_size_in_huge_pages; or SELECT name, setting, unit, context, source FROM pg_settings WHERE name = 'shared_memory_size_in_huge_pages';.
Tuning guidance
This is a preset, read-only parameter: it reports a value fixed when PostgreSQL was built or the cluster was initialized, and cannot be tuned at runtime. Read it to verify the server’s build or cluster configuration (for example when matching a replica or debugging a compatibility issue); there is no setting to adjust.
Reference
PostgreSQL documentation — shared_memory_size_in_huge_pages.