idle_in_transaction_session_timeout
Fact — official short description: “Sets the maximum allowed idle time between queries, when in a transaction.”
Identity
Lifecycle
| Fact | Value |
|---|---|
| First observed | PG9.6 |
| Present in | PG9.6–19 Beta 3 |
| Removed in | No |
| Introduction commit | c6dda1f48e57 — Add idle_in_transaction_session_timeout. |
| Commit date | 2016-03-16 |
| Discussion | — |
Default history
| Versions | Raw boot_val |
Unit | Human value |
|---|---|---|---|
| PG9.6–19 Beta 3 | 0 |
ms |
0 ms |
How it works
idle_in_transaction_session_timeout sets the maximum allowed idle time between queries, when in a transaction. 0 disables the timeout. It terminates sessions idle inside an open transaction, releasing locks and old snapshots that can block vacuum cleanup and cause bloat.
idle_in_transaction_session_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 idle_in_transaction_session_timeout from the service latency and failure budget, preferably per role or application. Test retries and cancellation paths before enforcing a cluster-wide value. |
| OLAP | Analytical work usually needs a larger or job-specific idle_in_transaction_session_timeout; preserve a finite guardrail for abandoned work without killing legitimate long scans. |
| Small nodes | Use a conservative finite idle_in_transaction_session_timeout only when the client or operating system handles termination correctly; verify that maintenance still has a dedicated exception. |
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 | 10min |
different | 10min |
| OLAP | 0 |
same as boot | 0 |
| CRIT | 1min |
different | 1min |
| TINY | 10min |
different | 10min |
Advice — pending human review. Fact from the current Pigsty template projection: OLTP: PG9.6–19 Beta 3 = 10min (dcs); OLAP: PG9.6–19 Beta 3 = 0 (dcs); CRIT: PG9.6–19 Beta 3 = 1min (dcs); TINY: PG9.6–19 Beta 3 = 10min (dcs). Advice, pending human review — Editorial inference: The templates bound abandoned open transactions, use a stricter limit for CRIT, and leave OLAP unlimited for deliberately long analytical transactions; each workload still needs pooler and retry review.
Common pitfalls
- Changing idle_in_transaction_session_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.
- Changing idle_in_transaction_session_timeout globally without a rollback plan and a client or operational compatibility test.
Related parameters
statement_timeout · lock_timeout · transaction_timeout · idle_session_timeout · deadlock_timeout
References
- PostgreSQL 19 Beta 3 — idle_in_transaction_session_timeout
- PostgreSQL 19 release notes
- Machine-readable GUC export