Parameter · Connections and Authentication / TCP Settings
tcp_keepalives_interval
Time between TCP keepalive retransmits. 0 means use the system default.
- Default:
0 - Type: integer (s)
- Range: 0 … max (2147483647)
- Applies: Session (any user)
In plain words
After the first keepalive probe gets no answer, the OS retries. This is the time between those retries. 0 means the OS default (75 seconds on Linux).
For DBAs and operators
Sets TCP_KEEPINTVL on TCP client sockets (ignored for Unix sockets, where it reads as 0). Total detection time is about tcp_keepalives_idle + tcp_keepalives_interval × tcp_keepalives_count. Lowering the interval only helps if the idle time is also reasonable; with the 2-hour Linux idle default it barely changes anything. On Windows, 0 means 1 second because the OS default cannot be read. When the connection is finally declared dead the backend logs LOG: could not receive data from client: Connection timed out.
Keepalive probes are only sent while the connection is idle at the TCP level. If the server is sending data that is not being acknowledged, retransmission rules apply instead; use tcp_user_timeout to bound that case.
How to change it
Any user can change it for their session with SET.