// postgresql · memory

huge_pages

Whether the shared memory segment uses huge pages (Linux and Windows).

기본값
try
Range
off, on, try
Restart needed
예
Default checked on
PostgreSQL 18

기능

try uses huge pages if the OS has enough reserved and silently falls back otherwise; on refuses to start without them. With a large shared_buffers, huge pages cut page-table memory and TLB misses.

기본값

try. try (PostgreSQL 18).

Check the current value

SHOW huge_pages;

SELECT setting, unit, boot_val, context, source, pending_restart
FROM pg_settings
WHERE name = 'huge_pages';

Change it

ALTER SYSTEM SET huge_pages = on;
-- applies only after a server restart

Server restart required (pg_settings.context is postmaster). ALTER SYSTEM only stages the new value in postgresql.auto.conf.

When to change it

Set it to on once vm.nr_hugepages is sized (shared_memory_size_in_huge_pages, PostgreSQL 15+, reports how many are needed), so a misconfiguration fails loudly instead of quietly falling back.

What can go wrong

With on, the server will not start if the huge pages are not reserved.

Questions about huge_pages

What is the default value of huge_pages in PostgreSQL?

try. try (PostgreSQL 18).

Does changing huge_pages require a restart?

Yes. Server restart required (pg_settings.context is postmaster). ALTER SYSTEM only stages the new value in postgresql.auto.conf.

When should I change huge_pages?

Set it to on once vm.nr_hugepages is sized (shared_memory_size_in_huge_pages, PostgreSQL 15+, reports how many are needed), so a misconfiguration fails loudly instead of quietly falling back.

Back to all PostgreSQL settings, or check the PostgreSQL manual for every option.

// one client for every engine

Check huge_pages on your own server

SQLly runs the query above against PostgreSQL and the other engines in this reference, from one desktop app on macOS, Windows and Linux.