Thread: pgsql: Add two attributes to pg_stat_database for parallel workers acti

pgsql: Add two attributes to pg_stat_database for parallel workers acti

From
Michael Paquier
Date:
Add two attributes to pg_stat_database for parallel workers activity

Two attributes are added to pg_stat_database:
* parallel_workers_to_launch, counting the total number of parallel
workers that were planned to be launched.
* parallel_workers_launched, counting the total number of parallel
workers actually launched.

The ratio of both fields can provide hints that there are not enough
slots available when launching parallel workers, also useful when
pg_stat_statements is not deployed on an instance (i.e. cf54a2c00254).

This commit relies on de3a2ea3b264, that has added two fields to EState,
that get incremented when executing Gather or GatherMerge nodes.

A test is added in select_parallel, where parallel workers are spawned.

Bump catalog version.

Author: Benoit Lobréau
Discussion: https://postgr.es/m/783bc7f7-659a-42fa-99dd-ee0565644e25@dalibo.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/e7a9496de90657e2161f68b3a5a9b2d9b0b7bb07

Modified Files
--------------
doc/src/sgml/monitoring.sgml                  | 18 ++++++++++++++++++
src/backend/catalog/system_views.sql          |  2 ++
src/backend/executor/execMain.c               |  5 +++++
src/backend/utils/activity/pgstat_database.c  | 19 +++++++++++++++++++
src/backend/utils/adt/pgstatfuncs.c           |  6 ++++++
src/include/catalog/catversion.h              |  2 +-
src/include/catalog/pg_proc.dat               | 10 ++++++++++
src/include/pgstat.h                          |  4 ++++
src/test/regress/expected/rules.out           |  2 ++
src/test/regress/expected/select_parallel.out | 27 +++++++++++++++++++++++++++
src/test/regress/sql/select_parallel.sql      | 14 ++++++++++++++
11 files changed, 108 insertions(+), 1 deletion(-)