Skip to content

unix_socket_directories

unix_socket_directories is the PostgreSQL setting that defines the directories where Unix-domain sockets will be created.
Note

Fact — official short description: “Sets the directories where Unix-domain sockets will be created.”

Identity

Type , Valuestring
Upstream pg_settings type
Context , Valuepostmaster
Requires a server restart
Unit , Value
Raw unit
Range , Value
Raw limits in the last observed version
Enum values , Value
— for non-enum types
Category , ValueConnections and Authentication / Connection Settings
Upstream classification
Latest boot value , Value/var/run/postgresql
/var/run/postgresql

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

Measured PG9.0–19 Beta 3 boot defaults
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

Tip

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'
Caution

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.

listen_addresses · port · max_connections · reserved_connections · superuser_reserved_connections

References