1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

Add leader_pid to pg_stat_activity

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
Reviewed-by: Sergei Kornilov, Guillaume Lelarge, Michael Paquier, Tomas
Vondra
Discussion: https://postgr.es/m/CAOBaU_Yy5bt0vTPZ2_LUM6cUcGeqmYNoJ8-Rgto+c2+w3defYA@mail.gmail.com
This commit is contained in:
Michael Paquier
2020-02-06 09:18:06 +09:00
parent bf6cc19e34
commit b025f32e0b
5 changed files with 47 additions and 25 deletions

View File

@ -622,6 +622,18 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
<entry><type>integer</type></entry>
<entry>Process ID of this backend</entry>
</row>
<row>
<entry><structfield>leader_pid</structfield></entry>
<entry><type>integer</type></entry>
<entry>
Process ID of the parallel group leader if this process is or
has been involved in parallel query, or null. This field is set
when a process wants to cooperate with parallel workers, and
remains set as long as the process exists. For a parallel group leader,
this field is set to its own process ID. For a parallel worker,
this field is set to the process ID of the parallel group leader.
</entry>
</row>
<row>
<entry><structfield>usesysid</structfield></entry>
<entry><type>oid</type></entry>