aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/nodeGather.c
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2017-11-15 08:17:29 -0500
committerRobert Haas <rhaas@postgresql.org>2017-11-15 08:23:18 -0500
commite5253fdc4f5fe2f38aec47e08c6aee93f934183d (patch)
treeb32d139116adab712dea0cb4ac02a939ff4aebd6 /src/backend/executor/nodeGather.c
parent7518049980be1d90264addab003476ae105f70d4 (diff)
downloadpostgresql-e5253fdc4f5fe2f38aec47e08c6aee93f934183d.tar.gz
postgresql-e5253fdc4f5fe2f38aec47e08c6aee93f934183d.zip
Add parallel_leader_participation GUC.
Sometimes, for testing, it's useful to have the leader do nothing but read tuples from workers; and it's possible that could work out better even in production. Thomas Munro, reviewed by Amit Kapila and by me. A few final tweaks by me. Discussion: http://postgr.es/m/CAEepm=2U++Lp3bNTv2Bv_kkr5NE2pOyHhxU=G0YTa4ZhSYhHiw@mail.gmail.com
Diffstat (limited to 'src/backend/executor/nodeGather.c')
-rw-r--r--src/backend/executor/nodeGather.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/backend/executor/nodeGather.c b/src/backend/executor/nodeGather.c
index 639f4f5af88..0298c65d065 100644
--- a/src/backend/executor/nodeGather.c
+++ b/src/backend/executor/nodeGather.c
@@ -38,6 +38,7 @@
#include "executor/nodeSubplan.h"
#include "executor/tqueue.h"
#include "miscadmin.h"
+#include "optimizer/planmain.h"
#include "pgstat.h"
#include "utils/memutils.h"
#include "utils/rel.h"
@@ -73,7 +74,8 @@ ExecInitGather(Gather *node, EState *estate, int eflags)
gatherstate->ps.ExecProcNode = ExecGather;
gatherstate->initialized = false;
- gatherstate->need_to_scan_locally = !node->single_copy;
+ gatherstate->need_to_scan_locally =
+ !node->single_copy && parallel_leader_participation;
gatherstate->tuples_needed = -1;
/*
@@ -193,9 +195,9 @@ ExecGather(PlanState *pstate)
node->nextreader = 0;
}
- /* Run plan locally if no workers or not single-copy. */
+ /* Run plan locally if no workers or enabled and not single-copy. */
node->need_to_scan_locally = (node->nreaders == 0)
- || !gather->single_copy;
+ || (!gather->single_copy && parallel_leader_participation);
node->initialized = true;
}