↑↓ 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 the 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.

Reading PG 18current·documented in 17 of 24 versions, 9.1 to 20

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

Columns 20

As listed in the PostgreSQL 18 manual.

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: startup: This WAL sender is starting up. catchup: This WAL sender's connected standby is catching up with the primary. streaming: This WAL sender is streaming changes after its connected standby server has caught up with the primary. backup: This WAL sender is sending a backup. stopping: This WAL sender is stopping.
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: async: This standby server is asynchronous. potential: This standby server is now asynchronous, but can potentially become synchronous if one of current synchronous ones fails. sync: This standby server is synchronous. quorum: This standby server is considered as a candidate for quorum standbys.
reply_timetimestamp with time zoneSend time of last reply message received from standby server
Column history across versions
Version history 7
  1. 18 → 19 reworded
  2. 12 → 13 reworded
  3. 11 → 12 changed
  4. 9.6 → 10 changed
  5. 9.3 → 9.4 changed
  6. 9.1 → 9.2 changed
  7. 9.0 → 9.1 added

Definition snapshot: english-manuals:74ace3042a76c7dafefae58cd9d… · English manual source