Re: Flush some statistics within running transactions - Mailing list pgsql-hackers

From Bertrand Drouvot
Subject Re: Flush some statistics within running transactions
Date
Msg-id aXcQ0Bdff5OsUDWY@ip-10-97-1-34.eu-west-3.compute.internal
Whole thread Raw
In response to Re: Flush some statistics within running transactions  (Bertrand Drouvot <bertranddrouvot.pg@gmail.com>)
Responses Re: Flush some statistics within running transactions
List pgsql-hackers
Hi,

On Thu, Jan 22, 2026 at 04:45:31PM +0000, Bertrand Drouvot wrote:
> On Thu, Jan 22, 2026 at 09:12:18PM +0900, Fujii Masao wrote:
> > 
> > With this setup, the following messages were logged once per second:
> > 
> >     LOG:  process 72199 still waiting for ShareLock on transaction 771
> > after 63034.119 ms
> >     DETAIL:  Process holding the lock: 72190. Wait queue: 72199.
> > 
> 
> Thanks!
> 
> I see, the WaitLatch() in ProcSleep() is "woken up" every 1s due to the 
> enable_timeout_after(ANYTIME_STATS_UPDATE_TIMEOUT,...) being set unconditionally
> in ProcessInterrupts(). We need to be more restrictive as to when to enable the
> timeout, I'll fix in the next version.

The attached, to apply on top of 0001, fix the issue. However it handles only the
WaitLatch in ProcSleep() case and I start to have concern about the others WaitLatch()
that would/could be "woken up" every 1s.

Using disable_timeout() and enable_timeout_after() in WaitEventSetWait() does not
look like a great answer to this concern, so I wonder if we should use a larger
flush frequency instead (as proposed up-thread), thoughts? 

Regards,

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

Attachment

pgsql-hackers by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: docs: clarify ALTER TABLE behavior on partitioned tables
Next
From: Chao Li
Date:
Subject: Re: tablecmds: reject CLUSTER ON for partitioned tables earlier