Re: Flush some statistics within running transactions

From: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Álvaro Herrera <alvherre(at)kurilemu(dot)de>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, Sami Imseih <samimseih(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
Subject: Re: Flush some statistics within running transactions
Date: 2026-02-03 17:58:37
Message-ID: aYI3TSVkrMMFvnfO@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 Tue, Feb 03, 2026 at 12:09:31PM -0500, Andres Freund wrote:
> Hi,
>
> On 2026-02-03 06:19:13 +0000, Bertrand Drouvot wrote:
> > On Fri, Jan 30, 2026 at 03:37:57PM +0100, Álvaro Herrera wrote:
> > > (Though to be honest, it's not clear to me why it would matter at which
> > > point in handle_sig_alarm we call SetLatch relative to the variables
> > > being set, given that these variables are only going to matter once the
> > > signal handler returns to the original code and the next
> > > CHECK_FOR_INTERRUPTS is hit.)
> >
> Why does it matter for your patch whether SetLatch() is done multiple times as
> part of various timeout handlers? I don't see how repeated SetLatch() calls
> could trigger more interference with ProcSleep()? Once the latch is set it is
> set (and indeed SetLatch() just returns immediately if it already is set).
>

Yeah, this was just a finding while diagnosing the ProcSleep() "issue". This
discussion is not relevant in this thread anymore (specially since v5 where the
design changed in such a way that the ProcSleep() "issue" does not appear
anymore).

We could open a dedicated thread if we think that's worth continuing the discussion
about removing the SetLatch() in those handlers (but they are probably harmless
to keep afterall). Thanks to you and Álvaro for having shared your thoughts on
it.

Regards,

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Jones 2026-02-03 18:22:16 Re: Additional message in pg_terminate_backend
Previous Message Andres Freund 2026-02-03 17:44:21 Re: Reduce timing overhead of EXPLAIN ANALYZE using rdtsc?