Re: Add per-backend lock statistics

From: Tatsuya Kawata <kawatatatsuya0913(at)gmail(dot)com>
To: Rui Zhao <zhaorui126(at)gmail(dot)com>
Cc: Bertrand Drouvot <bertranddrouvot(dot)pg(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-27 10:55:53
Message-ID: CAHza6qeCHa-iwM7PBT0X-Aw9XJBP9_rFYGinnqxedU8oPVfWbA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Bertrand-san,

Thanks for the explanation!

> I think that flushing statistics within running transactions [1] could
help to
> see what's going on for parallel workers too.

Thanks, I'll follow that thread.

> For parallel workers this window
> is very short (between the flush and the exit) so that we can say that
their stats
> are not visible in practice.

> That said, I'm not sure the doc needs any clarifications given that those
functions
> take a PID as parameter and that they state something like "Returns I/O
> /WAL statistics about the backend with the specified process ID".

Right, it's per-PID, and that part is clear. My concern is that it isn't
obvious from the function description that a single query can span more
than one PID, as it does with parallel workers.
If it's worth documenting, I agree splitting it across lock / I/O / WAL
separately isn't great -- a single place such as "Statistics Functions"
seems better. Either way it's separate from this patch, so I'll start a
dedicated thread with a draft.

> It's not related to this thread so that might be worth a dedicated one
but I'm
> not sure that would be more actionable while consuming more resources.

Thanks -- agreed there's a tradeoff here. I can see a use case for it, so
I'd like to weigh that against the cost and, if it still looks worth it,
post it as a separate patch to get more opinions.

No need to reflect either of these in the current patch.

Regards,
Tatsuya Kawata

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Dongpo Liu 2026-06-27 11:15:59 [PATCH] Use wait_classes.h in pg_prewarm
Previous Message Andrey Borodin 2026-06-27 10:41:25 Re: Why clearing the VM doesn't require registering vm buffer in wal record