Home Explore Blog CI



postgresql

15th chunk of `doc/src/sgml/config.sgml`
59ca42f90aff0b22624c3702a8c0f04f8eb23efc589f62990000000100000fbf
 default value.
        This parameter is supported only on systems that support
        <symbol>TCP_KEEPINTVL</symbol> or an equivalent socket option, and on
        Windows; on other systems, it must be zero.
        In sessions connected via a Unix-domain socket, this parameter is
        ignored and always reads as zero.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="guc-tcp-keepalives-count" xreflabel="tcp_keepalives_count">
      <term><varname>tcp_keepalives_count</varname> (<type>integer</type>)
      <indexterm>
       <primary><varname>tcp_keepalives_count</varname> configuration parameter</primary>
      </indexterm>
      </term>
      <listitem>
       <para>
        Specifies the number of TCP keepalive messages that can be lost before
        the server's connection to the client is considered dead.
        A value of 0 (the default) selects the operating system's default.
        This parameter is supported only on systems that support
        <symbol>TCP_KEEPCNT</symbol> or an equivalent socket option (which does not include Windows);
        on other systems, it must be zero.
        In sessions connected via a Unix-domain socket, this parameter is
        ignored and always reads as zero.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="guc-tcp-user-timeout" xreflabel="tcp_user_timeout">
      <term><varname>tcp_user_timeout</varname> (<type>integer</type>)
      <indexterm>
       <primary><varname>tcp_user_timeout</varname> configuration parameter</primary>
      </indexterm>
      </term>
      <listitem>
       <para>
        Specifies the amount of time that transmitted data may
        remain unacknowledged before the TCP connection is forcibly closed.
        If this value is specified without units, it is taken as milliseconds.
        A value of 0 (the default) selects the operating system's default.
        This parameter is supported only on systems that support
        <symbol>TCP_USER_TIMEOUT</symbol> (which does not include Windows); on other systems, it must be zero.
        In sessions connected via a Unix-domain socket, this parameter is
        ignored and always reads as zero.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="guc-client-connection-check-interval" xreflabel="client_connection_check_interval">
      <term><varname>client_connection_check_interval</varname> (<type>integer</type>)
      <indexterm>
       <primary><varname>client_connection_check_interval</varname> configuration parameter</primary>
      </indexterm>
      </term>
      <listitem>
       <para>
        Sets the time interval between optional checks that the client is still
        connected, while running queries.  The check is performed by polling
        the socket, and allows long running queries to be aborted sooner if
        the kernel reports that the connection is closed.
       </para>
       <para>
        This option relies on kernel events exposed by Linux, macOS, illumos
        and the BSD family of operating systems, and is not currently available
        on other systems.
       </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.
       </para>
       <para>
        For the kernel itself to detect lost TCP connections reliably and within
        a known timeframe in all scenarios including network failure, it may
        also be necessary to adjust the TCP keepalive settings of the operating
        system, or the <xref linkend="guc-tcp-keepalives-idle"/>,
        <xref linkend="guc-tcp-keepalives-interval"/> and
        <xref linkend="guc-tcp-keepalives-count"/> settings of
        <productname>PostgreSQL</productname>.

Title: More TCP Keepalive and Connection Check Configuration
Summary
This section details the configuration parameters related to TCP keepalive mechanisms and client connection checks in PostgreSQL. It covers `tcp_keepalives_count` (number of unacknowledged keepalive messages before the connection is considered dead), `tcp_user_timeout` (time for which transmitted data may remain unacknowledged before the connection is closed), and `client_connection_check_interval` (time interval between checks to ensure the client is still connected). System-specific behavior and limitations, particularly regarding Windows and Unix-domain sockets, are highlighted. The interaction between `client_connection_check_interval` and OS-level TCP keepalive settings is also mentioned.