Add leader_pid to pg_stat_activity

Enterprise / PostgreSQL - Michael Paquier [] - 6 February 2020 00:18 UTC

This new field tracks the PID of the group leader used with parallel query. For parallel workers and the leader, the value is set to the PID of the group leader. So, for the group leader, the value is the same as its own PID. Note that this reflects what PGPROC stores in shared memory, so as leader_pid is NULL if a backend has never been involved in parallel query. If the backend is using parallel query or has used it at least once, the value is set until the backend exits.

Author: Julien Rouhaud

b025f32e0b Add leader_pid to pg_stat_activity
doc/src/sgml/monitoring.sgml | 12 ++++++++++
src/backend/catalog/system_views.sql | 1 +
src/backend/utils/adt/pgstatfuncs.c | 44 +++++++++++++++++++++---------------
src/include/catalog/pg_proc.dat | 6 ++---
src/test/regress/expected/rules.out | 9 ++++----
5 files changed, 47 insertions(+), 25 deletions(-)


  • Share