If an application stops responding and abnormally terminates for any reason, the connection from the application may remain active on the database server. If this situation continues for an extended period, other applications attempting to connect to the database server may encounter an error, or an error indicating that the tables are unavailable may occur.
It is, therefore, recommended that idle connections be closed automatically at regular intervals.
Set the following parameters in the postgresql.conf file to indicate the time permitted to elapse before a connection is closed.
Parameter name | Setting | Description |
---|---|---|
tcp_keepalives_idle | Time until keepalive is sent (seconds) If 0, the default value of the system is used. | Sends keepalive to an idle connection at the specified interval in seconds It is recommended to specify 30 seconds. |
tcp_keepalives_interval | keepalive send interval (seconds) If 0, the default value of the system is used. | Sends keepalive at the specified interval It is recommended to specify 6 seconds. |
Note
The maximum number of connections allowed is 125, unless the desktop heap setting is changed.
See
Refer to "Connection Settings" under "Server Administration" in the PostgreSQL Documentation for information on the parameters.