Re: pg_stat_replication docs incomplete for logical replication
Re: pg_stat_replication docs incomplete for logical replication
От:
Peter Smith <smithpb2250@gmail.com>
Дата:
Hi Ashutosh.
+1 to clarify documentation.
Some minor review comments.
======
doc/src/sgml/monitoring.sgml
(27.2.4. pg_stat_replication)
1.
+
+ 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.
1a.
I'm not sure of the purpose of that blank line; it doesn't affect the
rendering in HTML.
~
1b.
Consider splitting the text differently so there is 1 paragraph for
"Physical Replication" and 1 paragraph for "Logical Replication". So,
the same content just with different markup.
SUGGESTION
For physical replication, ...
For logical replication, ...
~~~
2.
write_lsn pg_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
+ reported by the subscriber through replication status messages.
flush_lsn pg_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
+ reported by the subscriber through replication status messages.
Ditto review comment #2
~~~
4.
replay_lsn pg_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 reported by the subscriber through replication status
+ messages.
Ditto review comment #2
======
Kind Regards,
Peter Smith.
Fujitsu Australia
Re: pg_stat_replication docs incomplete for logical replication
Hi Peter, Thanks for reviewing the patch and sharing your feedback. Please find my responses inline below: On Tue, Jun 16, 2026 at 10:46 AM Peter Smith wrote: > > Hi Ashutosh. > > +1 to clarify documentation. > > Some minor review comments. > > ====== > > doc/src/sgml/monitoring.sgml > > (27.2.4. pg_stat_replication) > > 1. > + > + 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. > > > 1a. > I'm not sure of the purpose of that blank line; it doesn't affect the > rendering in HTML. > Agreed - this had no impact on the final output and was only added for readability purposes. I have removed it accordingly. > ~ > > 1b. > Consider splitting the text differently so there is 1 paragraph for > "Physical Replication" and 1 paragraph for "Logical Replication". So, > the same content just with different markup. > > SUGGESTION > > For physical replication, ... > > > For logical replication, ... > > Updated as suggested. > ~~~ > > 2. > write_lsn pg_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 > + reported by the subscriber through replication status messages. > > > For that 2nd sentence, do you mean /progress reported/progress is reported/ > > Or, here is some alternate wording: > For logical replication, progress is reported by replication status > messages received from the subscriber. > Updated as suggested. The same change has also been applied to flush_lsn and replay_lsn where similar feedback applied. Please find the updated patch attached and let me know for any further comments, thanks. -- With Regards, Ashutosh Sharma.
Re: pg_stat_replication docs incomplete for logical replication
От:
Peter Smith <smithpb2250@gmail.com>
Дата:
The latest patch LGTM regarding the content. But, there were some trivial issues. ====== 1. The patch name did not change. The 2nd patch was still called 0001? ~~~ 2. + + The pg_stat_replication view will contain one row + per WAL sender process, showing statistics about replication to that ... etc. Paragraph text is sometimes indented 1 space too many in the SGML file. AFAIK, text normally is aligned with the "p" of . ====== Kind Regards, Peter Smith. Fujitsu Australia
Re: pg_stat_replication docs incomplete for logical replication
Hi, On Thu, Jun 18, 2026 at 4:52 AM Peter Smith wrote: > > The latest patch LGTM regarding the content. > > But, there were some trivial issues. > > ====== > > 1. > The patch name did not change. The 2nd patch was still called 0001? > > ~~~ > > 2. > + > + The pg_stat_replication view will contain one row > + per WAL sender process, showing statistics about replication to that > ... etc. > > Paragraph text is sometimes indented 1 space too many in the SGML file. > AFAIK, text normally is aligned with the "p" of . > Thanks for your feedback. The attached patch addresses the alignment issue and has been tagged as v3. The two preceding patches, though untagged, can be considered v1 and v2 respectively. Please have a look and let me know for any further changes. -- With Regards, Ashutosh Sharma.
Re: pg_stat_replication docs incomplete for logical replication
От:
Peter Smith <smithpb2250@gmail.com>
Дата:
On Thu, Jun 18, 2026 at 4:26 PM Ashutosh Sharma wrote: > > Hi, > > On Thu, Jun 18, 2026 at 4:52 AM Peter Smith wrote: > > > > The latest patch LGTM regarding the content. > > > > But, there were some trivial issues. > > > > ====== > > > > 1. > > The patch name did not change. The 2nd patch was still called 0001? > > > > ~~~ > > > > 2. > > + > > + The pg_stat_replication view will contain one row > > + per WAL sender process, showing statistics about replication to that > > ... etc. > > > > Paragraph text is sometimes indented 1 space too many in the SGML file. > > AFAIK, text normally is aligned with the "p" of . > > > > Thanks for your feedback. The attached patch addresses the alignment > issue and has been tagged as v3. The two preceding patches, though > untagged, can be considered v1 and v2 respectively. > > Please have a look and let me know for any further changes. > Patch v3 LGTM. ====== Kind Regards, Peter Smith. Fujitsu Australia
CREATE INDEX vs. TOAST table stats
Commit d611f8b158 taught CREATE INDEX to avoid updating table stats when
autovacuum = off so that restored stats weren't wiped out. It included
RELKIND_TOASTVALUE in the list of affected relkinds, which I think is
incorrect for the following reasons:
* You can't restore stats for TOAST tables.
* If toast.autovacuum_enabled is unset for the TOAST table, it should
inherit the main table's setting, and the code doesn't do that. Per the
above point, there's little point in teaching it to do so.
This bug probably doesn't have much impact, other than perhaps increasing
the TOAST table's autovacuum priority immediately after restore. I think
we should just back-patch something like the following down to v18:
diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c
index 4c5da7e5db0..993a68fbc5e 100644
--- a/src/backend/catalog/index.c
+++ b/src/backend/catalog/index.c
@@ -2893,7 +2893,6 @@ index_update_stats(Relation rel,
* created, and we want to preserve the restored table statistics.
*/
if (rel->rd_rel->relkind == RELKIND_RELATION ||
- rel->rd_rel->relkind == RELKIND_TOASTVALUE ||
rel->rd_rel->relkind == RELKIND_MATVIEW)
{
if (AutoVacuumingActive())
--
nathan