Terminate sessions idle inside an open transaction.
At a glance
| Property | Value |
|---|---|
| Parameter | idle_in_transaction_session_timeout |
| Category | Client Defaults |
| Default | 0 |
| Value type | time (ms/s/min) |
| Change scope | Per-session (SET) |
What it does
Terminates any session that stays idle within an open transaction longer than the limit (SQLSTATE 25P03). 0 disables.
How to apply a change
Can be set per session with SET, per role/database with ALTER ROLE/DATABASE ... SET, or globally in postgresql.conf.
Inspect the current value and source with SHOW idle_in_transaction_session_timeout; or SELECT name, setting, unit, context, source FROM pg_settings WHERE name = 'idle_in_transaction_session_timeout';.
Tuning guidance
Set (e.g. 60s-5min) to kill abandoned transactions that hold locks and block VACUUM — a common cause of bloat and blocking. A leading defensive setting for OLTP.