| 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-17 16:33:54 |
| Message-ID: | aZSYcsRmqh7grqJb@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 Mon, Feb 16, 2026 at 04:00:56PM -0500, Andres Freund wrote:
> Hi,
>
> On 2026-02-16 10:10:21 +0000, Bertrand Drouvot wrote:
> > Yeah, providing the wait_time would be great. Just to be sure, are you suggesting
> > to remove all the fields (i.e requests, timeouts, deadlock_timeouts and fastpath)
> > and just add a wait_time field instead?
>
> Well, I'd maybe make it waits, wait_time and perhaps fastpath exceeded.
Okay, done that way in the attached. To avoid overhead due to timing as much as
possible, the patch simply relies on log_lock_waits and deadlock_timeout. It means
that it relies on the existing code, and increments waits and wait_time only if
log_lock_waits is on and if the session waited longer than deadlock_timeout.
I did not want to dissociate the waits and wait_time increments so that their
ratio could still make sense.
That sounds like a good compromise, thoughts?
> > I think that keeping requests would make sense to be able to get the average
> > wait time per request.
>
> I don't think I'd request for that (as that would require counting in the
> normal case), I'd use the number of waits.
Yeah, I meant to say waits and not requests.
Regards,
--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com
| Attachment | Content-Type | Size |
|---|---|---|
| v5-0001-Add-lock-statistics.patch | text/x-diff | 15.7 KB |
| v5-0002-Add-the-pg_stat_lock-view.patch | text/x-diff | 26.6 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Mark Wong | 2026-02-17 16:45:32 | Re: Recommended TPC-DS tools/setup for PostgreSQL benchmarking? |
| Previous Message | Andres Freund | 2026-02-17 16:30:59 | Re: Headerscheck support for meson |