An application can begin a transaction, read data, and then remain idle while doing other work. The open transaction can retain locks and prevent VACUUM from removing recently dead rows, causing table bloat, wasted disk space, and eventually transaction ID wraparound risk. section 6.5.1
Client A | Client B
------------------------+-----------------------
BEGIN; |
SELECT * FROM mytable; |
(...) |
| ALTER TABLE mytable
| ADD description text;
| *hangs*
Shows how an idle transaction in one client can make a concurrent ALTER TABLE hang. section 6.5.1
Set idle_in_transaction_session_timeout to terminate sessions that remain idle inside an open transaction longer than the configured number of milliseconds. This limits lock retention and VACUUM blockage, but the duration must allow legitimate post-BEGIN processing, and the application must tolerate the resulting disconnection. section 6.5.1
