mirror of
https://github.com/postgres/postgres.git
synced 2025-07-03 20:02:46 +03:00
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
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "executor/tqueue.h"
|
||||
#include "lib/binaryheap.h"
|
||||
#include "miscadmin.h"
|
||||
#include "optimizer/planmain.h"
|
||||
#include "utils/memutils.h"
|
||||
#include "utils/rel.h"
|
||||
|
||||
@ -233,8 +234,9 @@ ExecGatherMerge(PlanState *pstate)
|
||||
}
|
||||
}
|
||||
|
||||
/* always allow leader to participate */
|
||||
node->need_to_scan_locally = true;
|
||||
/* allow leader to participate if enabled or no choice */
|
||||
if (parallel_leader_participation || node->nreaders == 0)
|
||||
node->need_to_scan_locally = true;
|
||||
node->initialized = true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user