Re: Add memory_limit_hits to pg_stat_replication_slots

From: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Add memory_limit_hits to pg_stat_replication_slots
Date: 2025-09-22 08:11:22
Message-ID: aNEEqgDWxVeCZc6s@ip-10-97-1-34.eu-west-3.compute.internal
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Thu, Sep 11, 2025 at 03:24:54PM -0700, Masahiko Sawada wrote:
> On Wed, Aug 27, 2025 at 12:26 AM Bertrand Drouvot
> <bertranddrouvot(dot)pg(at)gmail(dot)com> wrote:
> >
> > Looking forward to your feedback,
>
> Yes,

Thanks for looking at it!

> it's a quite different situation in two cases: spilling 100
> transactions in one ReorderBufferCheckMemoryLimit() call and spilling
> 1 transaction in each 100 ReorderBufferCheckMemoryLimit() calls, even
> though spill_txn is 100 in both cases. And we don't have any
> statistics to distinguish between these cases.

Right.

> One minor comment is:
>
> @@ -1977,6 +1978,7 @@ UpdateDecodingStats(LogicalDecodingContext *ctx)
> repSlotStat.stream_bytes = rb->streamBytes;
> repSlotStat.total_txns = rb->totalTxns;
> repSlotStat.total_bytes = rb->totalBytes;
> + repSlotStat.memory_limit_hits = rb->memory_limit_hits;
>
> Since other statistics counter names are camel cases I think it's
> better to follow that for the new counter.

Makes sense, done with memoryLimitHits in v2 attached (that's the only change
as compared with v1).

Regards,

--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

Attachment Content-Type Size
v2-0001-Add-memory_limit_hits-to-pg_stat_replication_slot.patch text/x-diff 22.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Jones 2025-09-22 08:14:04 Re: We broke the defense against accessing other sessions' temp tables
Previous Message Daniel Gustafsson 2025-09-22 07:58:48 Re: docs: Validation error with xmllint 2.15.0