Terminate replication connections that are inactive for longer than this amount of time.
At a glance
| Property | Value |
|---|---|
| Parameter | wal_receiver_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 receiving standby server to detect a primary node 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.
(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_receiver_timeout; or SELECT name, setting, unit, context, source FROM pg_settings WHERE name = 'wal_receiver_timeout';.
Tuning guidance
Lower it so a standby gives up on a stalled primary sooner; raise it over flaky/WAN links to avoid needless reconnects. Pair with wal_retrieve_retry_interval.