Re: Adding locks statistics
Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
From: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Jeff Davis <pgsql@j-davis.com>, Greg Sabino Mullane <htamfids@gmail.com>, pgsql-hackers@lists.postgresql.org
Date: 2026-02-13T10:24:52Z
Lists: pgsql-hackers
Attachments
- v4-0001-Add-lock-statistics.patch (text/x-diff)
Hi, On Fri, Feb 13, 2026 at 04:36:57PM +0900, Michael Paquier wrote: > On Tue, Feb 10, 2026 at 07:30:50AM +0000, Bertrand Drouvot wrote: > > New rebase due to 73d60ac385a. > > I have been looking at this patch, and can get behind the data > gathered here in terms of being able to tune things Thanks! > > So my suggestion for the moment would be to be more frugal (yeah I > know, sorry..) and limit ourselves to four fields: deadlock_timeout, > requests, fastpath and timeouts. Three fields to compare with > requests, one for each GUC. That's fine by me. We could still add the others in the future if we feel the need. Done that way in the attached. > Regarding the implementation, you are right to use a fixed-sized stats > kind for the job. I can see a lot of code has been copy-pasted from > pgstat_io.c, then slightly adjusted to fit into the picture. That's > fine here, it makes the implementation straight-forward to read. Yeah, no need to reinvent the wheel. > Regarding the documentation, listing all the values for locktype is a > recipe for rot. I'd suggest to remove the list instead, with only a > link referring to pg_locks to avoid the duplication. Makes sense, done that way. Makes me think that we could do the same for pg_locks and just link it to the Wait Events of Type Lock? (Table 27.11.) 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