On Mon, Mar 16, 2026 at 7:18 PM Ashutosh Sharma <[email protected]> wrote: > > On Mon, Mar 16, 2026 at 4:40 PM Amit Kapila <[email protected]> wrote: > > > > On Mon, Mar 16, 2026 at 1:21 PM Ashutosh Sharma <[email protected]> > > wrote: > > > > > > 1) > > > v20260316-0001-Report-downstream-sent-bytes-in-pg_stat_replication_.patch: > > > > > > This patch introduces sent_bytes to report the amount of data sent > > > downstream. It documents sent_bytes in a way that it clarifies how > > > sent_bytes differs from total_bytes, without modifying the existing > > > documentation for total_bytes or total_txns. The patch is purely > > > additive and does not alter any existing documentation. > > > > > > > * > > + <structfield>sent_bytes</structfield><type>bigint</type> > > + </para> > > + <para> > > + Amount of transaction changes sent downstream for this slot by the > > + output plugin after applying output plugin filters, if any, and > > + converting it into the output plugin format. > > > > BTW, this also contains changes from pgoutput_message() which could be > > non-transactional. So, saying transaction changes may not be > > appropriate. > > > > I tried this based on my current understanding on this and observed > the follwoing: > > \c postgres > > CREATE PUBLICATION dbg_pub FOR ALL TABLES; > > SELECT * FROM pg_create_logical_replication_slot('dbg_pgout', 'pgoutput'); > > pg_recvlogical -d postgres \ > --slot=dbg_pgout \ > --start \ > -f /tmp/dbg_pgout.bin \ > -o proto_version='1' \ > -o publication_names='dbg_pub' \ > -o messages='true' > > SELECT pg_logical_emit_message(false, 'dbg', 'hello-non-tx'); > > SELECT slot_name, sent_txns, sent_bytes > FROM pg_stat_replication_slots > WHERE slot_name = 'dbg_pgout'; > > Observation: I do not see UpdateDecodingStats() being triggered for > this non-transactional message. >
I think that is probably a bug. I see that ReorderBufferQueueMessage() queues messages for transactional messages and which would then probably be sent later along with commit, so its data will be counted by UpdateDecodingStats. But the question is shouldn't we consider the data for non-transactional messages as well? > > Please correct me in case my understanding was wrong and I should have > checked for something else to verify this. > It doesn't seem to be related to this patch, so we can fix that separately if we agree that it is a bug. -- With Regards, Amit Kapila.
