Avoid counting transaction stats for parallel worker cooperating
authorAmit Kapila <akapila@postgresql.org>
Wed, 10 Apr 2019 03:06:42 +0000 (08:36 +0530)
committerAmit Kapila <akapila@postgresql.org>
Wed, 10 Apr 2019 03:06:42 +0000 (08:36 +0530)
commit036f7d3782e53573d2080e7d967fff375bc516b5
treecafc7fb1a8705c0d93ab904a1625dc05dda7de30
parent47b6362b58e03aa2e1f55550539f79321375693b
Avoid counting transaction stats for parallel worker cooperating
transaction.

The transaction that is initiated by the parallel worker to cooperate
with the actual transaction started by the main backend to complete the
query execution should not be counted as a separate transaction.  The
other internal transactions started and committed by the parallel worker
are still counted as separate transactions as we that is what we do in
other places like autovacuum.

This will partially fix the bloat in transaction stats due to additional
transactions performed by parallel workers.  For a complete fix, we need to
decide how we want to show all the transactions that are started internally
for various operations and that is a matter of separate patch.

Reported-by: Haribabu Kommi
Author: Haribabu Kommi
Reviewed-by: Amit Kapila, Jamison Kirk and Rahila Syed
Backpatch-through: 9.6
Discussion: https://postgr.es/m/CAJrrPGc9=jKXuScvNyQ+VNhO0FZk7LLAShAJRyZjnedd2D61EQ@mail.gmail.com
src/backend/access/transam/twophase.c
src/backend/access/transam/xact.c
src/backend/postmaster/pgstat.c
src/include/pgstat.h