# 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 {#identity}

| Field | Value | Meaning |
| --- | --- | --- |
| Type | `string` | Upstream pg_settings type |
| Context | `postmaster` | Requires a server restart |
| Unit | — | Raw unit |
| Range | — | Raw limits in the last observed version |
| Enum values | — | — for non-enum types |
| Category | Connections and Authentication / Connection Settings | Upstream classification |
| Latest boot value | `/var/run/postgresql` | /var/run/postgresql |
{.fields meta="-"}

## Lifecycle {#lifecycle}

| Fact | Value |
| --- | --- |
| First observed | PG9.3 |
| Present in | PG9.3–19 Beta 3 |
| Removed in | No |
| Introduction commit | [`c9b0cbe98bd7`](https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=c9b0cbe98bd783e24a8c4d8d8ac472a494b81292) — Support having multiple Unix-domain sockets per postmaster. |
| Commit date | 2012-08-10 |
| Discussion | — |

## Default history {#default-history}

| Versions | Raw `boot_val` | Unit | Human value |
| --- | --- | --- | --- |
| PG9.3–19 Beta 3 | `/var/run/postgresql` | — | /var/run/postgresql |
{.full-width caption="Measured PG9.0–19 Beta 3 boot defaults"}

## How it works {#mechanism}

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 {#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. |
{.full-width}

## Pigsty {#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'` |
{.full-width}

> [!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 {#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 {#related-parameters}

[`listen_addresses`](/parameters/listen-addresses/) · [`port`](/parameters/port/) · [`max_connections`](/parameters/max-connections/) · [`reserved_connections`](/parameters/reserved-connections/) · [`superuser_reserved_connections`](/parameters/superuser-reserved-connections/)

## References {#references}

- [PostgreSQL 19 Beta 3 — unix_socket_directories](https://www.postgresql.org/docs/19/runtime-config-connection.html#GUC-UNIX-SOCKET-DIRECTORIES)
- [PostgreSQL 19 release notes](https://www.postgresql.org/docs/19/release-19.html)
- [Machine-readable GUC export](/data/guc.jsonl)
