public inbox for [email protected]  
help / color / mirror / Atom feed
From: Bertrand Drouvot <[email protected]>
To: Fujii Masao <[email protected]>
Cc: Sami Imseih <[email protected]>
Cc: Michael Paquier <[email protected]>
Cc: [email protected]
Cc: Zsolt Parragi <[email protected]>
Subject: Re: Flush some statistics within running transactions
Date: Thu, 22 Jan 2026 16:45:31 +0000
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAHGQGwHttst8tv_WWYNoGGfL1UAq4kiy6dpFXoxEkJwHMS9FtQ@mail.gmail.com>
References: <[email protected]>
	<CAA5RZ0s9j3x5UPpgaQdDyGA=MNjVEkT73SL7LMoVEKUwiZrVqA@mail.gmail.com>
	<[email protected]>
	<CAA5RZ0s6FkEHFdgKf8J6vueZGwsH+08LvV0YPBXa4Dw_8QgtTw@mail.gmail.com>
	<[email protected]>
	<[email protected]>
	<CAA5RZ0sQxAu6bU8wTgvs+aTSvhBcziH9jCJ27aS1hzKsm2kmTQ@mail.gmail.com>
	<CAHGQGwGBkPEK=NpLuk1HSmccu6OA2FYqkkGcA-Hb3WLs6dX=cg@mail.gmail.com>
	<[email protected]>
	<CAHGQGwHttst8tv_WWYNoGGfL1UAq4kiy6dpFXoxEkJwHMS9FtQ@mail.gmail.com>

Hi,

On Thu, Jan 22, 2026 at 09:12:18PM +0900, Fujii Masao wrote:
> On Thu, Jan 22, 2026 at 4:43 PM Bertrand Drouvot
> <[email protected]> wrote:
> >
> > pgstat_report_anytime_stat() is called with the force parameter set to false,
> > means that the flushes are done with nowait = true means that LWLockConditionalAcquire()
> > is used. In that case, do you still see cases where log_lock_waits messages could
> > be triggered due to the new flush?
> 
> I haven't read the patch in detail yet, but after applying patch 0001 and
> causing a lock wait (for example, using the steps below), I observed that
> log_lock_waits messages are emitted every second.
> 
>     [session 1]
>     create table tbl as select id from generate_series(1, 10) id;
>     begin;
>     select * from tbl where id = 1 for update;
> 
>     [session 2]
>     begin;
>     select * from tbl where id = 1 for update;
> 
> 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.

Regards,

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






view thread (27+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Flush some statistics within running transactions
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox