Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to restrict the maximum duration of Postgres transactions?

On a Postgres server I want to limit the amount of time transactions may take before they are aborted.

There are two timeout settings in Postgres that relate to transaction, but I don’t think that they do accomplish what I need:

  • statement_timeout: Abort any statement that takes more than the specified amount of time.
  • idle_in_transaction_session_timeout: Terminate any session that has been idle (that is, waiting for a client query) within an open transaction for longer than the specified amount of time.

Do you know if there is a way to to restrict the maximum duration of Postgres transactions?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

There is no way to restrict the duration of a transaction. I the practical cases I have dealt with, a combination of the two parameters you quoted did the trick. But there is no way to limit the duration of a transaction that consists of millions of small statements with little idle time in between.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading