Shared memory used for the buffer cache.
At a glance
| Property | Value |
|---|---|
| Parameter | shared_buffers |
| Category | Memory |
| Default | 128MB |
| Value type | memory (kB/MB/GB) |
| Change scope | Restart required |
What it does
Sets the amount of shared memory PostgreSQL uses to cache data pages. This is the single most important memory setting and is allocated once at startup.
How to apply a change
Requires a full server restart (postmaster context). Set it in postgresql.conf and restart PostgreSQL.
Inspect the current value and source with SHOW shared_buffers; or SELECT name, setting, unit, context, source FROM pg_settings WHERE name = 'shared_buffers';.
Tuning guidance
A common starting point is 25% of system RAM (capped around a few GB to tens of GB on large boxes); the OS page cache handles the rest. Going far above 40% rarely helps and can hurt. Requires a restart and adequate kernel shared-memory / huge-page settings.