From 51efe38cb92f4b15b68811bcce9ab878fbc71ea5 Mon Sep 17 00:00:00 2001 From: Alexander Korotkov Date: Thu, 15 Feb 2024 23:34:11 +0200 Subject: Introduce transaction_timeout This commit adds timeout that is expected to be used as a prevention of long-running queries. Any session within the transaction will be terminated after spanning longer than this timeout. However, this timeout is not applied to prepared transactions. Only transactions with user connections are affected. Discussion: https://postgr.es/m/CAAhFRxiQsRs2Eq5kCo9nXE3HTugsAAJdSQSmxncivebAxdmBjQ%40mail.gmail.com Author: Andrey Borodin Author: Japin Li Author: Junwang Zhao Reviewed-by: Nikolay Samokhvalov Reviewed-by: Andres Freund Reviewed-by: Fujii Masao Reviewed-by: bt23nguyent Reviewed-by: Yuhang Qiu --- doc/src/sgml/config.sgml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'doc/src') diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index 037a3b8a64c..ffd711b7f21 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -9140,6 +9140,42 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv; + + transaction_timeout (integer) + + transaction_timeout configuration parameter + + + + + Terminate any session that spans longer than the specified amount of + time in the transaction. The limit applies both to explicit transactions + (started with BEGIN) and to an implicitly started + transaction corresponding to a single statement. + If this value is specified without units, it is taken as milliseconds. + A value of zero (the default) disables the timeout. + + + + If transaction_timeout is shorter or equal to + idle_in_transaction_session_timeout or statement_timeout + transaction_timeout will invalidate the longer timeout. + + + + Setting transaction_timeout in + postgresql.conf is not recommended because it would + affect all sessions. + + + + + Prepared transactions are not subject to this timeout. + + + + + lock_timeout (integer) -- cgit v1.2.3