unix_socket_directories
Fact — official short description: “Sets the directories where Unix-domain sockets will be created.”
Identity
Lifecycle
| Fact | Value |
|---|---|
| First observed | PG9.3 |
| Present in | PG9.3–19 Beta 3 |
| Removed in | No |
| Introduction commit | c9b0cbe98bd7 — Support having multiple Unix-domain sockets per postmaster. |
| Commit date | 2012-08-10 |
| Discussion | — |
Default history
| Versions | Raw boot_val |
Unit | Human value |
|---|---|---|---|
| PG9.3–19 Beta 3 | /var/run/postgresql |
— | /var/run/postgresql |
How it works
unix_socket_directories sets the directories where Unix-domain sockets will be created. PostgreSQL creates one socket and lock file per listed directory at startup; a value beginning with @ selects an abstract namespace on supported systems.
unix_socket_directories is a POSTMASTER-context setting: PostgreSQL reads it during server startup, and a configuration reload or session SET cannot activate a new value.
Unix-socket reachability combines directory existence and traversal rights, socket group and mode, the server account, and client search paths; pg_hba.conf local records still authenticate users.
Tuning advice
Advice. These are workload-specific starting points and must be validated with measurements.
| Workload | Guidance |
|---|---|
| OLTP | Configure unix_socket_directories as one Unix-socket access policy: choose trusted directories, ownership, group membership, and modes, then test local poolers, monitoring, backup, and administration. |
| OLAP | Use the same reviewed local-access boundary for analytical tools; add a directory or group only when its client and operating-system lifecycle are managed. |
| Small nodes | Keep unix_socket_directories simple and least-privileged. A local socket avoids TCP overhead only marginally and should not be made world-accessible for convenience. |
Pigsty
Values use the fixed 8-vCPU, 32-GiB, 100-GiB SSD fixture and render the current Pigsty templates for PG19 Beta 3; this does not assert current Pigsty support for that historical or beta release.
| Template | Effective value | Versus upstream boot | Source expression |
|---|---|---|---|
| OLTP | /var/run/postgresql, /tmp |
different | '/var/run/postgresql, /tmp' |
| OLAP | /var/run/postgresql, /tmp |
different | '/var/run/postgresql, /tmp' |
| CRIT | /var/run/postgresql, /tmp |
different | '/var/run/postgresql, /tmp' |
| TINY | /var/run/postgresql, /tmp |
different | '/var/run/postgresql, /tmp' |
Advice — pending human review. Fact from the current Pigsty template projection: OLTP: PG9.3–19 Beta 3 = /var/run/postgresql, /tmp (local); OLAP: PG9.3–19 Beta 3 = /var/run/postgresql, /tmp (local); CRIT: PG9.3–19 Beta 3 = /var/run/postgresql, /tmp (local); TINY: PG9.3–19 Beta 3 = /var/run/postgresql, /tmp (local). Advice, pending human review — Editorial inference: Providing both the distribution runtime directory and /tmp improves compatibility for local tools while retaining the conventional managed socket path.
Common pitfalls
- Expecting a reload or SET to activate unix_socket_directories, although it requires a controlled server restart.
- Opening the socket mode broadly while overlooking directory traversal, group membership, and pg_hba.conf local authentication.
- Adding a volatile or missing directory and preventing server startup or confusing local clients after restart.
- Changing unix_socket_directories globally without a rollback plan and a client or operational compatibility test.
Related parameters
listen_addresses · port · max_connections · reserved_connections · superuser_reserved_connections
References
- PostgreSQL 19 Beta 3 — unix_socket_directories
- PostgreSQL 19 release notes
- Machine-readable GUC export