| From: | Ashutosh Sharma <ashu(dot)coek88(at)gmail(dot)com> |
|---|---|
| To: | Michael Paquier <michael(at)paquier(dot)xyz> |
| Cc: | Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, shveta malik <shveta(dot)malik(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: Report bytes and transactions actually sent downtream |
| Date: | 2026-06-11 08:17:15 |
| Message-ID: | CAE9k0PnH0akGzSTrdQA0OgZ+JfpLb2mUxqM9bM_wf0yB0pAOWg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi Michael,
On Wed, Mar 25, 2026 at 12:25 PM Michael Paquier <michael(at)paquier(dot)xyz> wrote:
>
> On Wed, Mar 18, 2026 at 09:58:58AM +0530, Ashutosh Sharma wrote:
> > So the right boundary for sent_bytes is according to me would be:
> >
> > a) include logical decoding payload sent downstream (or via SQL
> > decoding path), whether it came from transactional changes or
> > non-transactional logical messages
> > b) exclude auxiliary replication protocol traffic such as keepalives
> >
> > If this makes sense then the revised documentation shared by Ashutosh
> > Bapat in his last email looks good to me, which is:
> >
> > Amount of transaction changes and non-transactional messages sent
> > downstream in the output plugin
> > format for this slot. The output plugin may filter the changes it
> > receives. Hence the amount of data that it converts to the output
> > plugin format is less than the <structfield>total_bytes</structfield>.
> > But the format of data before and after the conversion is different.
> > Hence the value of <structfield>sent_bytes</structfield> is not
> > directly related to the value of
> > <structfield>total_bytes</structfield>.
> >
> > If you all agree with this, I will first prepare a patch to fix the
> > missing part in #2 which is about reporting stats for
> > non-transactional messages that goes via logical decoding process and
> > then on top of that share the ongoing 0001 patch with above doc
> > change.
>
> Amit Kapila and I have both mentioned that the definition you are
> putting behind the sent_bytes field, as in "not accounting for the
> protocol messages required in the publisher-subscriber exchange"
> mentioned in b), feels strange, because these messages are sent over
> the wire and part of the exchanges, like the decoded data.
If we start including protocol messages such as keepalives in
sent_bytes, we may end up in situations where sent_bytes exceeds
total_bytes. All byte-related columns in the pg_stat_replication_slots
catalog currently refer specifically to decoded transactional data -
none of them account for non-transactional data or data that didn't go
through logical decoding. Including keepalive data in sent_bytes could
therefore cause it to exceed total_bytes, which would likely add
confusion and make the data harder for users to interpret.
--
With Regards,
Ashutosh Sharma.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Junwang Zhao | 2026-06-11 08:18:15 | Re: PG19 FK fast path: OOB write and missed FK checks during batched |
| Previous Message | cca5507 | 2026-06-11 07:50:19 | Re: [BUG] Take a long time to reach consistent after pg_rewind |