Set Statement Timeout

Set Statement Timeout

August 1, 2023

I don’t recall where I saw this, but in PostgreSQL, you can set a statement timeout to potentially prevent problems with a long running query running.

$ alter database mydatabase set statement_timeout = '60s';

Another thing you may want to set is idle_in_transaction timeout as well which will cancel long running transaction that are no longer performing work.

There is more information in PostgreSQL documentation.