On Wed, 4 Feb 2026 21:30:32 -0800
Jeremy Schneider <[email protected]> wrote:

> What would people here think about changing the default value of
> client_connection_check_interval to 2000 ms? Right now this is
> disabled by default.

Forgot the doc update in the attached patch. Updated

-Jeremy
>From b23d89338daaec9c381783fe6a9df9d148aeace7 Mon Sep 17 00:00:00 2001
From: Jeremy Schneider <[email protected]>
Date: Wed, 4 Feb 2026 21:08:32 -0800
Subject: [PATCH] Change default client_connection_check_interval to 2000ms

The default value of client_connection_check_interval is changed from 0
(disabled) to 2000ms (2 seconds). This enables periodic checking for client
disconnection during long-running queries by default, which can help detect
and clean up queries from disconnected clients more promptly.

A value of 0 continues to disable connection checking for users who prefer
the previous behavior.
---
 doc/src/sgml/config.sgml                      | 9 +++++----
 src/backend/utils/misc/guc_parameters.dat     | 2 +-
 src/backend/utils/misc/postgresql.conf.sample | 2 +-
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 5560b95ee60..5bc7f029e80 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -1059,10 +1059,11 @@ include_dir 'conf.d'
        </para>
        <para>
         If the value is specified without units, it is taken as milliseconds.
-        The default value is <literal>0</literal>, which disables connection
-        checks.  Without connection checks, the server will detect the loss of
-        the connection only at the next interaction with the socket, when it
-        waits for, receives or sends data.
+        The default value is <literal>2000</literal> (2 seconds).  A value of
+        <literal>0</literal> disables connection checks.  Without connection
+        checks, the server will detect the loss of the connection only at the
+        next interaction with the socket, when it waits for, receives or sends
+        data.
        </para>
        <para>
         For the kernel itself to detect lost TCP connections reliably and within
diff --git a/src/backend/utils/misc/guc_parameters.dat b/src/backend/utils/misc/guc_parameters.dat
index f0260e6e412..91c0d740ce5 100644
--- a/src/backend/utils/misc/guc_parameters.dat
+++ b/src/backend/utils/misc/guc_parameters.dat
@@ -403,7 +403,7 @@
   long_desc => '0 disables connection checks.',
   flags => 'GUC_UNIT_MS',
   variable => 'client_connection_check_interval',
-  boot_val => '0',
+  boot_val => '2000',
   min => '0',
   max => 'INT_MAX',
   check_hook => 'check_client_connection_check_interval',
diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample
index c4f92fcdac8..8dd89d6da4e 100644
--- a/src/backend/utils/misc/postgresql.conf.sample
+++ b/src/backend/utils/misc/postgresql.conf.sample
@@ -87,7 +87,7 @@
 #tcp_user_timeout = 0                   # TCP_USER_TIMEOUT, in milliseconds;
                                         # 0 selects the system default
 
-#client_connection_check_interval = 0   # time between checks for client
+#client_connection_check_interval = 2000        # time between checks for client
                                         # disconnection while running queries;
                                         # 0 for never
 
-- 
2.43.0

Reply via email to