| From: | Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com> |
|---|---|
| To: | Rui Zhao <zhaorui126(at)gmail(dot)com> |
| Cc: | Tatsuya Kawata <kawatatatsuya0913(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Subject: | Re: Add per-backend lock statistics |
| Date: | 2026-06-30 05:22:14 |
| Message-ID: | akNShhd8wVUVYbaP@bdtpg |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
On Thu, Jun 25, 2026 at 11:40:19PM +0800, Rui Zhao wrote:
> Hi Bertrand,
>
> I reviewed and tested v2; it builds cleanly. The implementation closely
> mirrors the existing per-backend IO/WAL stats (same flush path, struct
> layout, and backend-type guard), and the hot path is untouched: the
> per-backend counters piggyback on the existing global counting points
> (pgstat_count_lock_waits / pgstat_count_lock_fastpath_exceeded), so they
> only fire where pg_stat_lock already counts -- fastpath_exceeded when the
> fast-path slot limit is exceeded, and waits/wait_time only after a wait
> longer than deadlock_timeout.
Thanks for the review. Attached is a rebase due to c776550e466 and making
use of the same changes.
> One tiny nit: in pgstat_count_backend_lock_waits() and
> pgstat_count_backend_lock_fastpath_exceeded(), the Assert() is directly
> followed by the counter update. A blank line after the Assert() would read
> a bit better and is the more usual style in this code.
Yeah, done in the attached.
Regards,
--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com
| Attachment | Content-Type | Size |
|---|---|---|
| v3-0001-Refactor-pg_stat_get_lock-to-use-a-helper-functio.patch | text/x-diff | 3.2 KB |
| v3-0002-Add-per-backend-lock-statistics.patch | text/x-diff | 13.7 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Amit Kapila | 2026-06-30 05:32:27 | Re: Proposal: Conflict log history table for Logical Replication |
| Previous Message | David Steele | 2026-06-30 05:15:19 | Re: Return pg_control from pg_backup_stop(). |