pg_stat_replication
The pg_stat_replication view will contain one row per WAL sender process, showing statistics about replication to that sender's connected standby server. Only directly connected standbys are listed; no information is available about downstream standby servers.
English manual coverage begins with PostgreSQL 7.4. Source history and runtime observations have their own recorded version boundaries.
Reading PG 18·Select a recorded version
- kind
- statistics
- lang
- en
- measured attributes
- true
- metadata release
- 18.6
- runtime columns
- 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
- runtime verified
- false
- source
- english-manual
Definition PG 18
The pg_stat_replication view will contain one row per WAL sender process, showing statistics about replication to that sender's connected standby server. Only directly connected standbys are listed; no information is available about downstream standby servers.
Catalog columns
| Column | Type | Nullability | Description |
|---|---|---|---|
| pid | integer | Nullable | Process ID of a WAL sender process |
| usesysid | oid | Nullable | OID of the user logged into this WAL sender process |
| usename | name | Nullable | Name of the user logged into this WAL sender process |
| application_name | text | Nullable | Name of the application that is connected to this WAL sender |
| client_addr | inet | Nullable | IP 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_hostname | text | Nullable | Host 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_port | integer | Nullable | TCP port number that the client is using for communication with this WAL sender, or -1 if a Unix socket is used |
| backend_start | timestamp with time zone | Nullable | Time when this process was started, i.e., when the client connected to this WAL sender |
| backend_xmin | xid | Nullable | This standby's xmin horizon reported by hot_standby_feedback. |
| state | text | Nullable | Current 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_lsn | pg_lsn | Nullable | Last write-ahead log location sent on this connection |
| write_lsn | pg_lsn | Nullable | Last write-ahead log location written to disk by this standby server |
| flush_lsn | pg_lsn | Nullable | Last write-ahead log location flushed to disk by this standby server |
| replay_lsn | pg_lsn | Nullable | Last write-ahead log location replayed into the database on this standby server |
| write_lag | interval | Nullable | Time 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_lag | interval | Nullable | Time 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_lag | interval | Nullable | Time 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_priority | integer | Nullable | Priority 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_state | text | Nullable | Synchronous 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_time | timestamp with time zone | Nullable | Send time of last reply message received from standby server |
Compare versions
Complete source facts
documentation revision
{"inputs":[{"file":"monitoring-stats.html","kind":"same-version-reviewed-manual","locale":"en","sha256":"a97e4aa05484b41cec1f4c9b0b9c5a083596a056982e5d5ba0db1dd8d49961fb","version":"18.7"},{"file":"monitoring-stats.html","kind":"same-version-reviewed-manual","locale":"zh-Hans","sha256":"1ddb6576fe569e029a1c776c82e7add6be8e4f41705bcd8f66f4347fe23372b6","version":"18.7"}],"release":"18.7","runtime_remeasured":false,"source_revision":"pgdoc:b9f0e7232f60f380d642ac9b99226606c254b552"}Source references
Full definition and evidence JSON
Definition sources
center · PostgreSQL 18 · catalog-bilingual-repair:5c6946fcce7ceee8fcf81dd9e05660405e497e36ad507841dd92cd2118ba00aa
Text language: en · catalog-bilingual-repair:5c6946fcce7ceee8fcf81dd9e05660405e497e36ad507841dd92cd2118ba00aa