Terminate replication connections that are inactive for longer than this amount of time.
At a glance
| Property | Value |
|---|---|
| Parameter | wal_sender_timeout |
| Category | Replication |
| Default | 60 |
| Value type | integer |
| Change scope | Per-session (SET) |
| Available in | PostgreSQL 12, 13, 14, 15, 16, 17, 18, 19 (added in 12) |
What it does
Terminate replication connections that are inactive for longer than this amount of time. This is useful for the sending server to detect a standby crash or network outage. If this value is specified without units, it is taken as milliseconds. The default value is 60 seconds. A value of zero disables the timeout mechanism.
With a cluster distributed across multiple geographic locations, using different values per location brings more flexibility in the cluster management. A smaller value is useful for faster failure detection with a standby having a low-latency network connection, and a larger value helps in judging better the health of a standby if located on a remote location, with a high-latency network connection.
(Description quoted from the official PostgreSQL documentation.)
How to apply a change
Can be set per session with SET, per role/database with ALTER ROLE/DATABASE ... SET, or globally in postgresql.conf.
Inspect the current value and source with SHOW wal_sender_timeout; or SELECT name, setting, unit, context, source FROM pg_settings WHERE name = 'wal_sender_timeout';.
Tuning guidance
Lower it to detect dead replicas faster (quicker failover decisions); raise it on high-latency/WAN links so healthy senders are not killed. Keep it consistent with the receiver-side timeout.