Re: Parallel workers stats in pg_stat_database

Michael Banck <mbanck@gmx.net>

From: Michael Banck <mbanck@gmx.net>
To: Guillaume Lelarge <guillaume@lelarge.info>
Cc: Benoit Lobréau <benoit.lobreau@dalibo.com>, Michael Paquier <michael@paquier.xyz>, Bertrand Drouvot <bertranddrouvot.pg@gmail.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2024-11-12T14:05:31Z
Lists: pgsql-hackers
Hi,

On Fri, Oct 11, 2024 at 09:33:48AM +0200, Guillaume Lelarge wrote:
> FWIW, with the recent commits of the pg_stat_statements patch, you need a
> slight change in the patch I sent on this thread. You'll find a patch
> attached to do that. You need to apply it after a rebase to master.
> 
> -	if (estate->es_parallelized_workers_planned > 0) {
> +	if (estate->es_parallel_workers_to_launch > 0) {
>  		pgstat_update_parallel_workers_stats(
> -			(PgStat_Counter) estate->es_parallelized_workers_planned,
> -			(PgStat_Counter) estate->es_parallelized_workers_launched);
> +			(PgStat_Counter) estate->es_parallel_workers_to_launch,
> +			(PgStat_Counter) estate->es_parallel_workers_launched);

I was wondering about the weird new column name workers_to_launch when I
read the commit message - AFAICT this has been an internal term so far,
and this is the first time we expose it to users?

I personally find (parallel_)workers_planned/launched clearer from a
user perspective, was it discussed that we need to follow the internal
terms here? If so, I missed that discussion in this thread (and the
other thread that lead to cf54a2c00).


Michael



Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Add two attributes to pg_stat_database for parallel workers activity

  2. Introduce two fields in EState to track parallel worker activity