Re: Adding locks statistics

From: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Jeff Davis <pgsql(at)j-davis(dot)com>, Greg Sabino Mullane <htamfids(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Adding locks statistics
Date: 2026-02-27 05:14:31
Message-ID: aaEoN1XexvGiFvYp@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 Fri, Feb 20, 2026 at 05:26:37PM +0000, Bertrand Drouvot wrote:
> Hi,
>
> On Fri, Feb 20, 2026 at 11:02:49AM -0500, Andres Freund wrote:
> > Hi,
> >
> > How could a user benefit from that split? To me this is pointless number
> > gathering that wastes resources and confuses users.
>
> I was thinking that could be useful to know the distribution between "long" waits
> (greater than the deadlock timeout) among all the waits.
>
> If the vast majority are long waits that may indicate that the application is
> misbehaving (as opposed to a tiny percentage of long waits).
>
> I was also thinking to bring those stats per-backend (as a next step) and that
> could also probably be more useful (distribution per host for example, thanks to
> joining with pg_stat_activity).

As it seems that I'm the only one thinking that this split could be useful, I'm
removing it in the attached. We can still split later on if we have requests from
the field.

So, we're back to what we were discussing before the split. As in v7, 0003 is
adding the new GUC. So that we can see what having a new GUC implies in ProcSleep()
and we can just get rid of 0003 if we think the GUC is not worth the extra complexity
(I don't have a strong opinion on it but tempted to think that the extra GUC is
not worth it).

Regards,

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

Attachment Content-Type Size
v8-0001-Add-lock-statistics.patch text/x-diff 15.6 KB
v8-0002-Add-the-pg_stat_lock-view.patch text/x-diff 29.9 KB
v8-0003-Introduce-a-new-track_lock_timing-GUC.patch text/x-diff 25.6 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2026-02-27 05:33:33 Re: Skipping schema changes in publication
Previous Message Yura Sokolov 2026-02-27 05:00:28 Re: Fix bug in multixact Oldest*MXactId initialization and access