client_connection_check_interval
Fact — official short description: “Sets the time interval between checks for disconnection while running queries.”
Identity
Lifecycle
| Fact | Value |
|---|---|
| First observed | PG14 |
| Present in | PG14–19 Beta 3 |
| Removed in | No |
| Introduction commit | c30f54ad732c — Detect POLLHUP/POLLRDHUP while running queries. |
| Commit date | 2021-04-03 |
| Discussion | thread 1 |
Default history
| Versions | Raw boot_val |
Unit | Human value |
|---|---|---|---|
| PG14–19 Beta 3 | 0 |
ms |
0 ms |
How it works
client_connection_check_interval sets the time interval between checks for disconnection while running queries. 0 disables connection checks. A nonzero interval lets long-running queries notice a dead client before their next socket write; operating-system support determines whether checks are effective.
client_connection_check_interval 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 | Use a nonzero client_connection_check_interval only when abandoning work after client loss materially saves capacity and the platform supports the check. Measure the polling overhead at the chosen interval. |
| OLAP | Long analytical queries can benefit from periodic disconnect detection because they may otherwise run after a client disappears; the interval does not cap a healthy query’s runtime. |
| Small nodes | Leave zero unless orphaned long queries are observed. If enabled, choose an interval that detects waste without adding excessive checks to active queries. |
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: PG14–19 Beta 3 unmodified; OLAP: PG14–19 Beta 3 unmodified; CRIT: PG14–19 Beta 3 unmodified; TINY: PG14–19 Beta 3 unmodified. No Pigsty-specific rationale is inferred from an absent override.
Common pitfalls
- Changing client_connection_check_interval 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.
- Changing client_connection_check_interval globally without a rollback plan and a client or operational compatibility test.
Related parameters
tcp_keepalives_idle · tcp_keepalives_interval · tcp_keepalives_count · tcp_user_timeout · authentication_timeout
References
- PostgreSQL 19 Beta 3 — client_connection_check_interval
- PostgreSQL 19 release notes
- Machine-readable GUC export