Re: Report bytes and transactions actually sent downtream

From: Ashutosh Sharma <ashu(dot)coek88(at)gmail(dot)com>
To: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
Cc: michael(at)paquier(dot)xyz, ashutosh(dot)bapat(dot)oss(at)gmail(dot)com, amit(dot)kapila16(at)gmail(dot)com, bertranddrouvot(dot)pg(at)gmail(dot)com, andres(at)anarazel(dot)de, shveta(dot)malik(at)gmail(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Report bytes and transactions actually sent downtream
Date: 2026-06-12 08:36:40
Message-ID: CAE9k0PmkJWqt3uJnq6hm0191Q-dC6QMRWfzcDFxh-V4e5nnqQA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Fri, Jun 12, 2026 at 12:32 PM Kyotaro Horiguchi
<horikyota(dot)ntt(at)gmail(dot)com> wrote:
>
> Let me go back to the original motivation.
>
> As I understand it, the problem was that, among several subscribers
> connected through different slots, one slot was lagging behind. The
> total_txns and total_bytes values for that slot appeared smaller, and
> you wanted to know where the bottleneck was.
>
> I wonder if part of the confusion comes from the fact that it is not
> yet clear what conclusions a user is expected to draw from these new
> values.
>
> What I am still not quite sure about is how the proposed sent_bytes
> value would be used to make that distinction. It sounds like the idea
> is not necessarily to look at its rate over time, but perhaps to
> compare total_bytes with the proposed sent_bytes. However, as has
> been discussed, these two values seem to measure different things, so
> I am not sure that such a comparison would be straightforward.
>
> I think it would help move the discussion forward if you could explain
> more concretely how these new values would be used to identify the
> bottleneck in the case you described.
>

Regarding the use case of this new metric, this is my understanding,
although Ashutosh Bapat would be in a better position to comment on
its intended value and use cases. I'll wait for his perspective as
well.

My understanding is as follows:

During logical decoding, ReorderBufferProcessTXN() iterates through
the decoded changes belonging to a top-level transaction and its
subtransactions in LSN order, invoking the output plugin callbacks for
each change. For large transactions, it may be useful to expose
progress while this processing is still in progress. For example, the
system could track logical changes as they are processed and sent
downstream, periodically publishing progress to shared memory so that
users can understand how far the walsender has progressed through a
large transaction.

By contrast, total_bytes is essentially an end-of-transaction metric.
It becomes available only after processing has completed and therefore
does not provide visibility into the walsender's progress while a
large transaction is actively being decoded and streamed.

--
With Regards,
Ashutosh Sharma.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ewan Young 2026-06-12 08:39:54 REPACK CONCURRENTLY fails on tables with generated columns
Previous Message Kyotaro Horiguchi 2026-06-12 08:33:30 Re: [BUG] Take a long time to reach consistent after pg_rewind