This document describes the system configuration parameters in the Replication category.
Warning!
To ensure system stability and security, manually modifying these parameters should be done with caution.
These settings control the behavior of streaming replication. A server can act as either a primary (master) or standby. The primary server sends data, while the standby always acts as the receiver of replicated data. These parameters are primarily used on both sending servers and standby servers, although some are meaningful only on the master.
The parameters in this section must be set on the Master and on any Standby that will send replication data.
Sets the maximum number of replication slots that the server can support.
replica or higher.| Data Type | Default Value | Range | Category |
|---|---|---|---|
| int | 10 | 1 ~ 262143 | segments; system; restart |
Sets the maximum WAL size (in MB) that can be retained by replication slots.
-1, which disables this feature.| Data Type | Default Value | Range | Category |
|---|---|---|---|
| int | -1 | -1 ~ INT_MAX/1024 | segments; system; reload |
Sets the maximum number of concurrent connections from standby servers or streaming base backup clients (i.e., the maximum number of WAL sender processes running simultaneously).
replica or higher to allow connections from standby servers.| Data Type | Default Value | Range | Category |
|---|---|---|---|
| int | 10 | 0 ~ 262143 | segments; system; restart |
Enables tracking of transaction commit timestamps.
| Data Type | Default Value | Category |
|---|---|---|
| boolean | off | segments; system; restart |
When set to on, fills new WAL files with zeros.
off, only the last byte is written when the file is created, giving it the expected size.| Data Type | Default Value | Category |
|---|---|---|
| boolean | on | segments; session; reload; superuser |
Specifies the minimum number of past log file segments to retain in the pg_wal directory, in case a standby server needs them for streaming replication.
wal_keep_segments segments behind, the sending server may remove a WAL segment still needed by the standby, breaking the replication connection. Eventually, the downstream connection will also fail (though if WAL archiving is used, the standby may recover by fetching segments from the archive).pg_wal; the system may retain additional segments for WAL archiving or checkpoint recovery.0 (default), the system retains no extra segments for standby purposes. Thus, the number of old WAL segments available to the standby depends on the position of the last checkpoint and the WAL archiving status.| Data Type | Default Value | Range | Category |
|---|---|---|---|
| int | 64 | 0 ~ INT_MAX | segments; system; reload |
Enables recycling of WAL files.
on, WAL files are reused via renaming to avoid creating new files.| Data Type | Default Value | Category |
|---|---|---|
| boolean | on | segments; session; reload; superuser |
Terminates replication connections that have been inactive for longer than the specified time (in milliseconds).
0 disables the timeout.300000毫秒, i.e., 5 minutes.| Data Type | Default Value | Range | Category |
|---|---|---|---|
| int | 300000 | 0 ~ INT_MAX | segments; session; reload; superuser |
These settings are ignored on Standby servers.
Note!
In addition to these parameters, an appropriate wal_level must be set on the Master, and WAL archiving should be enabled as needed.
Specifies a list of standby servers that support synchronous replication.
application_name set in the connection information. List entries are separated by commas.primary_conninfo configuration. If not set, it defaults to cluster_name, otherwise walreceiver.'*' matches any standby name.This parameter uses one of the following syntaxes to specify a standby list:
[FIRST] num_sync ( standby_name [, ...] )
ANY num_sync ( standby_name [, ...] )
standby_name [, ...]
num_sync is the number of synchronous standbys whose replies a transaction must wait for, and standby_name is a standby server name. FIRST and ANY specify how synchronous standbys are selected from the list.FIRST with num_sync specifies priority-based synchronous replication. Transaction commits wait until WAL records are replicated to num_sync highest-priority standbys selected from the list. For example, FIRST 3 (s1, s2, s3, s4) causes each commit to wait for replies from three highest-priority standbys chosen from s1, s2, s3, and s4.FIRST is optional.ANY with num_sync specifies quorum-based synchronous replication. Commits wait until WAL records are replicated to at least num_sync of the listed standbys. For example, ANY 3 (s1, s2, s3, s4) allows a commit to proceed after receiving replies from any three of s1, s2, s3, and s4.FIRST and ANY are case-insensitive. If used as standby names, they must be enclosed in double quotes.FIRST and num_sync equal to 1. For example, FIRST 1 (s1, s2) means the same as s1, s2: either s1 or s2 will be selected as the synchronous standby.standby_name should be a valid SQL identifier unless it is *. Double quotes may be used if necessary. However, comparison of standby_name and standby application names is case-insensitive (regardless of quoting).local or off.| Data Type | Default Value | Category |
|---|---|---|
| string | segments; system; reload |
Specifies how long (in number of transactions) updates to VACUUM and HOT should defer cleanup of dead row versions.
hot_standby_feedback on the standby as an alternative.old_snapshot_threshold.| Data Type | Default Value | Range | Category |
|---|---|---|---|
| int | 0 | 0 ~ 1000000 | segments; system; reload |
These settings are ignored on the Master server.
Specifies whether connections and queries can be run during recovery.
| Data Type | Default Value | Category |
|---|---|---|
| boolean | off | segments; system; restart |
Specifies whether a hot standby sends feedback to the master or upstream standby about currently executing queries on the standby.
wal_receiver_status_interval cycle.old_snapshot_threshold behavior on the master. A snapshot on the standby exceeding the master's age threshold may become invalid, causing transaction cancellation on the standby. This is because old_snapshot_threshold imposes an absolute limit on how long dead rows can persist, preventing disruption due to standby configuration.| Data Type | Default Value | Category |
|---|---|---|
| boolean | off | segments; system; reload |
When hot standby is active, this parameter sets the maximum time (in milliseconds) the standby waits before canceling queries that conflict with WAL entries about to be applied. See Handling Query Conflicts.
-1 applies when WAL data is being read from WAL archives (and thus not current WAL).max_standby_archive_delay allows the standby to wait indefinitely until the conflicting query ends.max_standby_streaming_delay is not the maximum time a single query can run before cancellation; it is the maximum total time allowed to apply any WAL segment. Thus, if an early query causes significant delay, subsequent conflicting queries will have less time.| Data Type | Default Value | Range | Category |
|---|---|---|---|
| int | 30000 | -1 ~ INT_MAX | segments; system; reload |
When hot standby is active, this parameter sets the maximum time (in milliseconds) the standby waits before canceling queries that conflict with WAL entries about to be applied. See Handling Query Conflicts.
max_standby_streaming_delay applies when WAL data is received via streaming replication.-1 allows the standby to wait indefinitely until the conflicting query ends.| Data Type | Default Value | Range | Category |
|---|---|---|---|
| int | 30000 | -1 ~ INT_MAX | segments; system; reload |
Specifies the connection string used by the standby to connect to the sending server.
primary_conninfo string or in a separate ~/.pgpass file on the standby (using replication as the database name).primary_conninfo string.| Data Type | Default Value | Category |
|---|---|---|
| string | segments; system; restart; superuser |
Optionally specifies an existing replication slot to use when connecting via streaming replication, to control resource removal on the upstream node.
primary_conninfo is not set.| Data Type | Default Value | Category |
|---|---|---|
| string | segments; system; restart |
Specifies a trigger file whose existence ends recovery on the standby.
pg_ctl promote or by calling pg_promote.| Data Type | Default Value | Category |
|---|---|---|
| string | segments; system; reload |
By default, the standby applies WAL records from the sending server as quickly as possible.
hot_standby_feedback, potentially causing master bloat—use with caution when both are enabled.0, meaning no delay is added.Note!
Whensynchronous_commitis set toremote_apply, synchronous replication is affected—eachCOMMITmust wait for the delay to elapse before applying.
| Data Type | Default Value | Range | Category |
|---|---|---|---|
| int | 0 | 0 ~ INT_MAX | segments; system; reload |
Sets the minimum frequency (in seconds) at which the WAL receiver process on the standby sends status information about replication progress to the master or upstream standby.
0 disables status updates entirely.| Data Type | Default Value | Range | Category |
|---|---|---|---|
| int | 10 | 0 ~ INT_MAX/1000 | segments; system; reload |
Terminates replication connections that have been inactive for longer than the specified time (in milliseconds).
0 disables the timeout.| Data Type | Default Value | Range | Category |
|---|---|---|---|
| int | 60000 | 0 ~ INT_MAX | segments; system; reload |
Specifies how long (in milliseconds) a standby should wait before retrying to fetch WAL data when no data is available from any source (streaming replication, local pg_wal, or WAL archive).
| Data Type | Default Value | Range | Category |
|---|---|---|---|
| int | 5000 | 1 ~ INT_MAX | segments; system; reload |
These parameters control the behavior of logical replication subscribers. Their values on the publisher are irrelevant.
Note!
The configuration parameterswal_receiver_timeout,wal_receiver_status_interval, andwal_retrieve_retry_intervalalso affect logical replication workers.
Sets the maximum number of logical replication workers. This includes both apply workers and table synchronization workers.
max_worker_processes.| Data Type | Default Value | Range | Category |
|---|---|---|---|
| int | 4 | 0 ~ 262143 | segments; system; restart |
Sets the maximum number of synchronization workers per subscription.
max_logical_replication_workers.| Data Type | Default Value | Range | Category |
|---|---|---|---|
| int | 2 | 0 ~ 262143 | segments; system; reload |