select open change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

CONFIGURATION / REPLICATION

max_wal_senders

Read PG 18 manual ↗

Specifies the maximum number of concurrent connections from standby servers or streaming base backup clients (i.e., the maximum number of simultaneously running WAL sender processes).

Type
integer
Context
postmaster
Measured default
10
Unit
Metadata snapshot
18

Definition PG 18 manual

Specifies the maximum number of concurrent connections from standby servers or streaming base backup clients (i.e., the maximum number of simultaneously running WAL sender processes). The default is 10. The value 0 means replication is disabled. Abrupt disconnection of a streaming client might leave an orphaned connection slot behind until a timeout is reached, so this parameter should be set slightly higher than the maximum number of expected clients so disconnected clients can immediately reconnect. This parameter can only be set at server start. Also, wal_level must be set to replica or higher to allow connections from standby servers.

When running a standby server, you must set this parameter to the same or higher value than on the primary server. Otherwise, queries will not be allowed in the standby server.

Measured default history
Version intervalDefault
9.0 – 9.60
10 – 1910
Analysis & operational context

Authored guidance from the GUC source snapshot; the version-specific manual above is the definition reference. View source ↗

How it works

Sets the maximum number of simultaneously running WAL sender processes. The value is fixed when the server starts, so changing it requires a restart.

Each streaming standby, WAL-streaming base backup, or logical replication connection can occupy a WAL sender. Zero disables sending, disconnected clients may retain a slot until timeout, and a standby must reserve at least as many senders as its primary to accept hot-standby queries safely.

Monitor and change max_wal_senders together with wal_level, max_replication_slots, archive_mode. Validate on the relevant server role and real workload, then use its postmaster context to choose session change, reload, or restart; a historical boot default is not the current effective value.

Operational considerations

Changing it on the wrong primary, standby, sender, or subscriber role.

Watching only configured bytes/time instead of actual lag, slot position, and worker state.

Failing over to a node that lacks the old primary's capacity or prerequisites.

Using infinite waits or WAL retention to hide a failed consumer.

Workload guidance

OLAP: Read standbys and logical subscribers often see long queries or large transactions. Put explicit bounds on replay/apply and monitor lag, worker saturation, slot restart_lsn, and conflict cancellations.

OLTP: Size max_wal_senders from topology, failover roles, slot/subscription count, and reconnect headroom. Test worst-case primary latency, standby replay, and disk retention before production.

SMALL: Configure only replication capacity that is actually used. Even a small topology needs bounded timeouts and slot lifecycle; unlimited retention is not reliability.

Version history 10
  1. PG 19 → 20changed
  2. PG 13 → 14changed
  3. PG 12 → 13changed
  4. PG 11 → 12changed
  5. PG 10 → 11changed
  6. PG 9.6 → 10changed
  7. PG 9.5 → 9.6changed
  8. PG 9.3 → 9.4changed
  9. PG 9.1 → 9.2changed
  10. PG 9.0 → 9.1changed

Related entries

Further reading

Definition snapshot: english-manuals:db7c269c9723aa260bf192e95e4… · English manual source