tcp_user_timeout
Fact — official short description: “TCP user timeout.”
Identity
Lifecycle
| Fact | Value |
|---|---|
| First observed | PG12 |
| Present in | PG12–19 Beta 3 |
| Removed in | No |
| Introduction commit | 249d64999615 — Add support TCP user timeout in libpq and the backend server |
| Commit date | 2019-04-06 |
| Discussion | thread 1 |
Default history
| Versions | Raw boot_val |
Unit | Human value |
|---|---|---|---|
| PG12–19 Beta 3 | 0 |
ms |
0 ms |
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.
Tuning advice
Advice. These are workload-specific starting points and must be validated with measurements.
| Workload | Guidance |
|---|---|
| OLTP | Set tcp_user_timeout from the maximum acceptable unacknowledged-data stall, below the service failover budget and with client retry behavior tested. |
| 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. |
| Small nodes | Use the operating-system default unless measured half-open connections require a bound; confirm platform support before relying on it. |
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 | Unmodified | — | — |
| OLAP | Unmodified | — | — |
| CRIT | Unmodified | — | — |
| TINY | Unmodified | — | — |
Advice — pending human review. Fact from the current Pigsty template projection: OLTP: PG12–19 Beta 3 unmodified; OLAP: PG12–19 Beta 3 unmodified; CRIT: PG12–19 Beta 3 unmodified; TINY: PG12–19 Beta 3 unmodified. No Pigsty-specific rationale is inferred from an absent override.
Common pitfalls
- 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.
Related parameters
tcp_keepalives_idle · tcp_keepalives_interval · tcp_keepalives_count · client_connection_check_interval · authentication_timeout