Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 7124c93

Browse files
author
Amit Kapila
committed
Match the buffer usage tracking for leader and worker backends.
In the leader backend, we don't track the buffer usage for ExecutorStart phase whereas in worker backend we track it for ExecutorStart phase as well. This leads to different value for buffer usage stats for the parallel and non-parallel query. Change the code so that worker backend also starts tracking buffer usage after ExecutorStart. Author: Amit Kapila and Robert Haas Reviewed-by: Robert Haas and Andres Freund Backpatch-through: 9.6 where this code was introduced Discussion: https://postgr.es/m/86137f17-1dfb-42f9-7421-82fd786b04a1@anayrat.info
1 parent 764e21d commit 7124c93

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/backend/executor/execParallel.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -735,12 +735,19 @@ ParallelQueryMain(dsm_segment *seg, shm_toc *toc)
735735
instrument_options = instrumentation->instrument_options;
736736
queryDesc = ExecParallelGetQueryDesc(toc, receiver, instrument_options);
737737

738-
/* Prepare to track buffer usage during query execution. */
739-
InstrStartParallelQuery();
740-
741738
/* Start up the executor, have it run the plan, and then shut it down. */
742739
ExecutorStart(queryDesc, 0);
743740
ExecParallelInitializeWorker(queryDesc->planstate, toc);
741+
742+
/*
743+
* Prepare to track buffer usage during query execution.
744+
*
745+
* We do this after starting up the executor to match what happens in the
746+
* leader, which also doesn't count buffer accesses that occur during
747+
* executor startup.
748+
*/
749+
InstrStartParallelQuery();
750+
744751
ExecutorRun(queryDesc, ForwardScanDirection, 0L);
745752
ExecutorFinish(queryDesc);
746753

0 commit comments

Comments
 (0)