Postgresql – What determines the time waited for Postgres Transaction Timeout

postgresql

What parameter would you change to set how long Postgres waits before deciding a transaction has been interrupted and should be rolled back?

I have a client program that is being frequently terminated in the middle of updating a postgres database. I need to make sure that postgres catches the loss of connection to the client as quickly as possible and immediately rollsback the transaction.

I have control over the timeout settings on the program, if those matter. I also have control over the postgres database, but I'm not sure what I should be changing on either if not both.

Best Answer

idle_in_transaction_session_timeout (integer)

Releases locks on open transactions that have become idle.

idle_in_transaction_session_timeout parameter