select open change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

CONFIGURATION / CONNECTIONS AND AUTHENTICATION

tcp_user_timeout

Read PG 18 manual ↗

Specifies the amount of time that transmitted data may remain unacknowledged before the TCP connection is forcibly closed.

Type
integer
Context
user
Measured default
0 ms
Unit
ms
Metadata snapshot
18

Definition PG 18 manual

Specifies the amount of time that transmitted data may remain unacknowledged before the TCP connection is forcibly closed. If this value is specified without units, it is taken as milliseconds. A value of 0 (the default) selects the operating system's default. This parameter is supported only on systems that support TCP_USER_TIMEOUT (which does not include Windows); on other systems, it must be zero. In sessions connected via a Unix-domain socket, this parameter is ignored and always reads as zero.

Measured default history
Version intervalDefault
12 – 190 ms
Analysis & operational context

Authored guidance from the GUC source snapshot; the version-specific manual above is the definition reference. View source ↗

How it works

tcp_user_timeout sets the TCP user timeout. 0 means use the system default. Where supported, it bounds how long transmitted data may remain unacknowledged before TCP closes the connection; it is distinct from keepalive probing of an idle connection.

tcp_user_timeout is a USER-context setting. An authorized role can change it for a session, while ALTER ROLE or ALTER DATABASE can establish a default for future sessions.

Timeouts overlap: the first applicable deadline wins, while client, pooler, TCP, and server cancellation behavior determines whether work is retried, canceled, or the session is closed.

Operational considerations

Changing tcp_user_timeout in one session and assuming role defaults, database defaults, or other pooled sessions changed with it.

Forgetting that zero usually disables the timeout or delegates behavior to the operating system.

Setting overlapping deadlines without deciding which layer owns retries, cancellation, and connection disposal.

Confusing unacknowledged-data timeout with keepalive detection for an otherwise idle socket.

Workload guidance

OLAP: Allow for temporary congestion during large result transfer, but keep the value below the point where an unreachable peer wastes a worker for the rest of the job window.

OLTP: Set tcp_user_timeout from the maximum acceptable unacknowledged-data stall, below the service failover budget and with client retry behavior tested.

SMALL: Use the operating-system default unless measured half-open connections require a bound; confirm platform support before relying on it.

Version history 4
  1. PG 17 → 18changed
  2. PG 15 → 16changed
  3. PG 13 → 14changed
  4. PG 11 → 12added

Related entries

Further reading

Definition snapshot: english-manuals:7512996358834d904b0b7681030… · English manual source