client_connection_check_interval

A configuration parameter for checking whether the client connection is still active
This entry relates to a PostgreSQL feature which is part of PostgreSQL 14, due to be released in late 2021.

client_connection_check_interval is a configuration parameter for checking whether the client connection is still active, if the underlying operating system supports this functionality,

client_connection_check_interval was added in PostgreSQL 14.

Usage

check_client_connection_interval is only available on operating systems which support the POLLRDHUP extension to the poll system call.

Currently this is only supported by Linux.

Default value

The default value for check_client_connection_interval is: 0 (disabled).

Change history

Examples

With check_client_connection_interval disabled (set to 0), PostgreSQL will only detect client disconnection once a query has completed:

postgres=# SHOW client_connection_check_interval;
 client_connection_check_interval 
----------------------------------
 0
(1 row)

postgres=# SELECT pg_sleep(15);
Terminated

The corresponding log file entries:

[2021-04-02 11:09:23 UTC] psql postgres postgres LOG:  00000: statement: SELECT pg_sleep(15);
[2021-04-02 11:09:38 UTC] psql postgres postgres LOG:  00000: disconnection: session time: 0:03:17.753 user=postgres database=postgres host=127.0.0.1 port=38516

With check_client_connection_interval enabled:

postgres=# SHOW client_connection_check_interval;
 client_connection_check_interval 
----------------------------------
 5s
(1 row)

postgres=# SELECT pg_sleep(15);
Terminated

The corresponding log file entries:

[2021-04-02 11:14:20 UTC] psql postgres postgres LOG:  00000: statement: SELECT pg_sleep(15);
[2021-04-02 11:14:25 UTC] psql postgres postgres FATAL:  08006: connection to client lost
[2021-04-02 11:14:25 UTC] psql postgres postgres STATEMENT:  SELECT pg_sleep(15);
[2021-04-02 11:14:25 UTC] psql postgres postgres LOG:  00000: disconnection: session time: 0:00:34.703 user=postgres database=postgres host=127.0.0.1 port=38594

Here the client disconnection is detected just after check_client_connection_interval has elapsed, and well before the query would otherwise terminate.

Categories

GUC configuration item

See also

tcp_user_timeout