Parameter · Preset Options
shared_memory_size
Shows the size of the server's main shared memory area (rounded up to the nearest MB).
- Default:
0 - Type: integer (MB)
- Range: 0 … max (2147483647)
- Applies: Read-only
In plain words
How much shared memory the server reserved at startup: shared buffers plus WAL buffers, lock tables, caches for transaction status and more. It is calculated from your settings and rounded up to whole megabytes.
For DBAs and operators
Added in PostgreSQL 15. Readable without starting the server: postgres -D $PGDATA -C shared_memory_size, handy for capacity planning and container memory limits. It is typically shared_buffers plus a few percent, but large max_connections, max_locks_per_transaction, wal_buffers or SLRU buffer settings add up. Dynamic shared memory (parallel query) is not included, except the part preallocated with min_dynamic_shared_memory.
SHOW shared_memory_size;
SELECT name, pg_size_pretty(allocated_size) FROM pg_shmem_allocations
ORDER BY allocated_size DESC LIMIT 10;How to change it
Fixed when PostgreSQL was built or the cluster was initialised. You can only read it.
See it in context
Related parameters
shared_buffers shared_memory_size_in_huge_pages huge_pages max_connections