Re: Adding locks statistics

From: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: 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-13 10:24:52
Message-ID: aY779Gu3rQwJ4Erq@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 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

Attachment Content-Type Size
v4-0001-Add-lock-statistics.patch text/x-diff 14.9 KB
v4-0002-Add-the-pg_stat_lock-view.patch text/x-diff 15.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jelte Fennema-Nio 2026-02-13 10:28:20 Re: Make copyObject work in C++
Previous Message Bertrand Drouvot 2026-02-13 10:08:32 Re: Fix uninitialized xl_running_xacts padding