DB Internals AtlasPostgreSQL 18.6 Home About

Parameter · Resource Usage / Memory

dynamic_shared_memory_type

Selects the dynamic shared memory implementation used.

  • Default: posix
  • Type: enum
  • Values: posix · sysv · mmap
  • Applies: Restart required

In plain words

Parallel queries need shared memory segments created on the fly so the leader and workers can exchange data. This chooses how those segments are made. The default, posix, uses /dev/shm.

For DBAs and operators

Used for parallel query (tuple queues, shared hash tables of Parallel Hash, parallel bitmap scans), parallel CREATE INDEX/VACUUM and some extensions. Options: posix (shm_open, files appear in /dev/shm/PostgreSQL.*), sysv, mmap (files in $PGDATA/pg_dynshmem, discouraged: the OS may write them back to disk) and windows.

Classic container problem

Docker gives /dev/shm only 64 MB by default. A big Parallel Hash join then fails with ERROR: could not resize shared memory segment "/PostgreSQL.123456" to 50438144 bytes: No space left on device. Fix with --shm-size (or emptyDir: medium: Memory in Kubernetes), or preallocate with min_dynamic_shared_memory. Also make sure systemd-logind's RemoveIPC=yes does not delete segments of the postgres user (use a system user).

How to change it

Change in postgresql.conf or ALTER SYSTEM, then restart the server.

See it in context

Parallel query Memory architecture Parallel and background workers

Related parameters

min_dynamic_shared_memory shared_memory_type max_parallel_workers_per_gather

All Resource Usage parameters