Re: Adding locks statistics
Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
From: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
To: Andres Freund <andres@anarazel.de>
Cc: Michael Paquier <michael@paquier.xyz>, Jeff Davis <pgsql@j-davis.com>, Greg Sabino Mullane <htamfids@gmail.com>, pgsql-hackers@lists.postgresql.org
Date: 2026-02-27T05:14:31Z
Lists: pgsql-hackers
Attachments
- v8-0001-Add-lock-statistics.patch (text/x-diff)
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
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Fix injection point detach timing problem in TAP test for lock stats
- 3284e3f63cf0 19 (unreleased) landed
-
Use single LWLock for lock statistics in pgstats
- 404a17c155ac 19 (unreleased) landed
-
Add tests for lock statistics, take two
- 557a9f1e3e62 19 (unreleased) landed
-
Remove isolation test lock-stats
- 7c64d56fd976 19 (unreleased) landed
-
Avoid including clog.h in proc.h
- f227b7b20c36 19 (unreleased) landed
-
Don't include storage/lock.h in so many headers
- 2102ebb1953f 19 (unreleased) landed
-
Add support for lock statistics in pgstats
- 4019f725f5d4 19 (unreleased) landed
-
Move some code blocks in lock.c and proc.c
- a90d86518243 19 (unreleased) landed
-
Move declarations related to locktags from lock.h to new locktag.h
- 322bab79744d 19 (unreleased) landed