aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/execParallel.c
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2017-12-19 12:21:56 -0500
committerRobert Haas <rhaas@postgresql.org>2018-01-04 12:46:00 -0500
commit2157a61b5aa3805a9e0fb11fa2fd4da9ca54234c (patch)
treed9c47ee86312cf1cc728abcec37ce670e73c2b64 /src/backend/executor/execParallel.c
parentb64d6c9341522e89f30beecc72ce8859afd8b6c9 (diff)
downloadpostgresql-2157a61b5aa3805a9e0fb11fa2fd4da9ca54234c.tar.gz
postgresql-2157a61b5aa3805a9e0fb11fa2fd4da9ca54234c.zip
Back-port fix for accumulation of parallel worker instrumentation.
When a Gather or Gather Merge node is started and stopped multiple times, accumulate instrumentation data only once, at the end, instead of after each execution, to avoid recording inflated totals. This is a back-port of commit 8526bcb2df76d5171b4f4d6dc7a97560a73a5eff by Amit Kapila. Discussion: http://postgr.es/m/20171127175631.GA405@depesz.com Discussion: http://postgr.es/m/CAA4eK1KT3BYj50qWhK5qBF=LDzQCoUVSFZjcK3mHoJJeWA+fNA@mail.gmail.com
Diffstat (limited to 'src/backend/executor/execParallel.c')
-rw-r--r--src/backend/executor/execParallel.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/backend/executor/execParallel.c b/src/backend/executor/execParallel.c
index 4741aec46de..6eed6db3355 100644
--- a/src/backend/executor/execParallel.c
+++ b/src/backend/executor/execParallel.c
@@ -536,7 +536,7 @@ ExecParallelRetrieveInstrumentation(PlanState *planstate,
/*
* Finish parallel execution. We wait for parallel workers to finish, and
- * accumulate their buffer usage and instrumentation.
+ * accumulate their buffer usage.
*/
void
ExecParallelFinish(ParallelExecutorInfo *pei)
@@ -553,23 +553,23 @@ ExecParallelFinish(ParallelExecutorInfo *pei)
for (i = 0; i < pei->pcxt->nworkers_launched; ++i)
InstrAccumParallelQuery(&pei->buffer_usage[i]);
- /* Finally, accumulate instrumentation, if any. */
- if (pei->instrumentation)
- ExecParallelRetrieveInstrumentation(pei->planstate,
- pei->instrumentation);
-
pei->finished = true;
}
/*
- * Clean up whatever ParallelExecutorInfo resources still exist after
- * ExecParallelFinish. We separate these routines because someone might
- * want to examine the contents of the DSM after ExecParallelFinish and
- * before calling this routine.
+ * Accumulate instrumentation, and then clean up whatever ParallelExecutorInfo
+ * resources still exist after ExecParallelFinish. We separate these
+ * routines because someone might want to examine the contents of the DSM
+ * after ExecParallelFinish and before calling this routine.
*/
void
ExecParallelCleanup(ParallelExecutorInfo *pei)
{
+ /* Accumulate instrumentation, if any. */
+ if (pei->instrumentation)
+ ExecParallelRetrieveInstrumentation(pei->planstate,
+ pei->instrumentation);
+
if (pei->pcxt != NULL)
{
DestroyParallelContext(pei->pcxt);