select open change scope Open full search

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

SYSTEM CATALOGS / STATISTICS VIEWS

pg_stat_replication

Read PG 18 manual ↗

The pg_stat_replication view will contain one row per WAL sender process, showing statistics about replication to that sender's connected standby server.

Kind
Statistics views
Columns in this snapshot
20
Definition source
English manual

Columns 20

ColumnTypeDescription / reference
pidintegerProcess ID of a WAL sender process
usesysidoidOID of the user logged into this WAL sender process
usenamenameName of the user logged into this WAL sender process
application_nametextName of the application that is connected to this WAL sender
client_addrinetIP address of the client connected to this WAL sender. If this field is null, it indicates that the client is connected via a Unix socket on the server machine.
client_hostnametextHost name of the connected client, as reported by a reverse DNS lookup of client_addr. This field will only be non-null for IP connections, and only when log_hostname is enabled.
client_portintegerTCP port number that the client is using for communication with this WAL sender, or -1 if a Unix socket is used
backend_starttimestamp with time zoneTime when this process was started, i.e., when the client connected to this WAL sender
backend_xminxidThis standby's xmin horizon reported by hot_standby_feedback.
statetextCurrent WAL sender state. Possible values are:
sent_lsnpg_lsnLast write-ahead log location sent on this connection
write_lsnpg_lsnLast write-ahead log location written to disk by this standby server
flush_lsnpg_lsnLast write-ahead log location flushed to disk by this standby server
replay_lsnpg_lsnLast write-ahead log location replayed into the database on this standby server
write_lagintervalTime elapsed between flushing recent WAL locally and receiving notification that this standby server has written it (but not yet flushed it or applied it). This can be used to gauge the delay that synchronous_commit level remote_write incurred while committing if this server was configured as a synchronous standby.
flush_lagintervalTime elapsed between flushing recent WAL locally and receiving notification that this standby server has written and flushed it (but not yet applied it). This can be used to gauge the delay that synchronous_commit level on incurred while committing if this server was configured as a synchronous standby.
replay_lagintervalTime elapsed between flushing recent WAL locally and receiving notification that this standby server has written, flushed and applied it. This can be used to gauge the delay that synchronous_commit level remote_apply incurred while committing if this server was configured as a synchronous standby.
sync_priorityintegerPriority of this standby server for being chosen as the synchronous standby in a priority-based synchronous replication. This has no effect in a quorum-based synchronous replication.
sync_statetextSynchronous state of this standby server. Possible values are:
reply_timetimestamp with time zoneSend time of last reply message received from standby server
Column history across versions
Column9.09.19.29.39.49.59.61011121314151617181920
pid··
usesysid·
usename·
application_name·
client_addr·
client_hostname·
client_port·
backend_start·
backend_xmin····
state·
sent_lsn·······
write_lsn·······
flush_lsn·······
replay_lsn·······
write_lag·······
flush_lag·······
replay_lag·······
sync_priority·
sync_state·
reply_time·········
procpid·················
sent_location············
write_location············
flush_location············
replay_location············
Version history 9
  1. PG 18 → 19changed
  2. PG 12 → 13changed
  3. PG 11 → 12changed
  4. PG 9.6 → 10changed
  5. PG 9.5 → 9.6changed
  6. PG 9.4 → 9.5changed
  7. PG 9.3 → 9.4changed
  8. PG 9.1 → 9.2changed
  9. PG 9.0 → 9.1added

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