From 8222e8a7a7312de75359464e6fc2baad16e29974 Mon Sep 17 00:00:00 2001 From: Ashutosh Sharma Date: Tue, 16 Jun 2026 10:40:24 +0000 Subject: [PATCH] doc: clarify pg_stat_replication view for logical replication Update the pg_stat_replication documentation to cover logical replication alongside physical replication. The view now mentions logical subscribers in addition to standbys, and a new paragraph explains the differing semantics of the LSN columns depending on replication type: - For physical replication, the LSN columns reflect WAL sending, writing, flushing, and replay on the standby as before. - For logical replication, sent_lsn reflects publisher-side decoding progress, not delivery to the subscriber. write_lsn, flush_lsn, and replay_lsn reflect subscriber-reported progress via replication status messages, and do not guarantee that changes have been received, durably stored, or applied on the subscriber side. Author: Ashutosh Sharma Reviewed-by: Peter Smith --- doc/src/sgml/monitoring.sgml | 51 +++++++++++++++++++++++++++--------- 1 file changed, 38 insertions(+), 13 deletions(-) diff --git a/doc/src/sgml/monitoring.sgml b/doc/src/sgml/monitoring.sgml index 08d5b824552..ca88f0d44ba 100644 --- a/doc/src/sgml/monitoring.sgml +++ b/doc/src/sgml/monitoring.sgml @@ -323,7 +323,7 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser pg_stat_replicationpg_stat_replication One row per WAL sender process, showing statistics about - replication to that sender's connected standby server. + replication to that sender's directly connected client. See pg_stat_replication for details. @@ -1212,11 +1212,30 @@ description | Waiting for a newly initialized WAL file to reach durable storage 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. + + The pg_stat_replication view will contain one row + per WAL sender process, showing statistics about replication to that + sender's directly connected client. For physical replication, the client + is a standby server. For logical replication, the client is a logical + replication client, such as a subscriber apply worker. No information is + available about downstream replication nodes. + + + For physical replication, the LSN columns in this view describe the + positions up to which WAL has been sent, written, flushed, and replayed + on the connected standby server. + + + For logical replication, sent_lsn reflects the + LSN up to which the walsender has processed WAL records. Such records may + already have been streamed to the subscriber, queued for streaming at + transaction commit, or skipped because they were not eligible for logical + decoding. + write_lsn, flush_lsn, + and replay_lsn reflect progress reported by the + subscriber through replication status messages, and do not necessarily + mean that logical changes up to those LSNs have already been + received, durably stored, or made visible on the subscriber. @@ -1371,7 +1390,9 @@ description | Waiting for a newly initialized WAL file to reach durable storage sent_lsnpg_lsn - Last write-ahead log location sent on this connection + For physical replication, the last write-ahead log location sent on + this connection. For logical replication, the last write-ahead log + location processed by this walsender. @@ -1380,8 +1401,9 @@ description | Waiting for a newly initialized WAL file to reach durable storage write_lsnpg_lsn - Last write-ahead log location written to disk by this standby - server + For physical replication, the last write-ahead log location written + to disk by this standby server. For logical replication, progress is + reported by replication status messages received from the subscriber. @@ -1390,8 +1412,9 @@ description | Waiting for a newly initialized WAL file to reach durable storage flush_lsnpg_lsn - Last write-ahead log location flushed to disk by this standby - server + For physical replication, the last write-ahead log location flushed + to disk by this standby server. For logical replication, progress is + reported by replication status messages received from the subscriber. @@ -1400,8 +1423,10 @@ description | Waiting for a newly initialized WAL file to reach durable storage replay_lsnpg_lsn - Last write-ahead log location replayed into the database on this - standby server + For physical replication, the last write-ahead log location replayed + into the database on this standby server. For logical replication, + progress is reported by replication status messages received from the + subscriber. -- 2.43.0