static void
create_plain_partial_paths(PlannerInfo *root, RelOptInfo *rel)
{
- int parallel_degree = 1;
+ int parallel_workers = 1;
/*
- * If the user has set the parallel_degree reloption, we decide what to do
+ * If the user has set the parallel_workers reloption, we decide what to do
* based on the value of that option. Otherwise, we estimate a value.
*/
- if (rel->rel_parallel_degree != -1)
+ if (rel->rel_parallel_workers != -1)
{
/*
- * If parallel_degree = 0 is set for this relation, bail out. The
+ * If parallel_workers = 0 is set for this relation, bail out. The
* user does not want a parallel path for this relation.
*/
- if (rel->rel_parallel_degree == 0)
+ if (rel->rel_parallel_workers == 0)
return;
/*
- * Use the table parallel_degree, but don't go further than
- * max_parallel_degree.
+ * Use the table parallel_workers, but don't go further than
+ * max_parallel_workers_per_gather.
*/
- parallel_degree = Min(rel->rel_parallel_degree, max_parallel_degree);
+ parallel_workers = Min(rel->rel_parallel_workers, max_parallel_workers_per_gather);
}
else
{
* sophisticated, but we need something here for now.
*/
while (rel->pages > parallel_threshold * 3 &&
- parallel_degree < max_parallel_degree)
+ parallel_workers < max_parallel_workers_per_gather)
{
- parallel_degree++;
+ parallel_workers++;
parallel_threshold *= 3;
if (parallel_threshold >= PG_INT32_MAX / 3)
break;
}
/* Add an unordered partial path based on a parallel sequential scan. */
- add_partial_path(rel, create_seqscan_path(root, rel, NULL, parallel_degree));
+ add_partial_path(rel, create_seqscan_path(root, rel, NULL, parallel_workers));
}
/*
{
AppendPath *appendpath;
ListCell *lc;
- int parallel_degree = 0;
+ int parallel_workers = 0;
/*
- * Decide what parallel degree to request for this append path. For
- * now, we just use the maximum parallel degree of any member. It
+ * Decide on the numebr of workers to request for this append path. For
+ * now, we just use the maximum value from among the members. It
* might be useful to use a higher number if the Append node were
* smart enough to spread out the workers, but it currently isn't.
*/
{
Path *path = lfirst(lc);
- parallel_degree = Max(parallel_degree, path->parallel_degree);
+ parallel_workers = Max(parallel_workers, path->parallel_workers);
}
- Assert(parallel_degree > 0);
+ Assert(parallel_workers > 0);
/* Generate a partial append path. */
appendpath = create_append_path(rel, partial_subpaths, NULL,
- parallel_degree);
+ parallel_workers);
add_partial_path(rel, (Path *) appendpath);
}
*/
Path *
create_seqscan_path(PlannerInfo *root, RelOptInfo *rel,
- Relids required_outer, int parallel_degree)
+ Relids required_outer, int parallel_workers)
{
Path *pathnode = makeNode(Path);
pathnode->pathtarget = rel->reltarget;
pathnode->param_info = get_baserel_parampathinfo(root, rel,
required_outer);
- pathnode->parallel_aware = parallel_degree > 0 ? true : false;
+ pathnode->parallel_aware = parallel_workers > 0 ? true : false;
pathnode->parallel_safe = rel->consider_parallel;
- pathnode->parallel_degree = parallel_degree;
+ pathnode->parallel_workers = parallel_workers;
pathnode->pathkeys = NIL; /* seqscan has unordered result */
cost_seqscan(pathnode, root, rel, pathnode->param_info);
required_outer);
pathnode->parallel_aware = false;
pathnode->parallel_safe = rel->consider_parallel;
- pathnode->parallel_degree = 0;
+ pathnode->parallel_workers = 0;
pathnode->pathkeys = NIL; /* samplescan has unordered result */
cost_samplescan(pathnode, root, rel, pathnode->param_info);
required_outer);
pathnode->path.parallel_aware = false;
pathnode->path.parallel_safe = rel->consider_parallel;
- pathnode->path.parallel_degree = 0;
+ pathnode->path.parallel_workers = 0;
pathnode->path.pathkeys = pathkeys;
/* Convert clauses to indexquals the executor can handle */
required_outer);
pathnode->path.parallel_aware = false;
pathnode->path.parallel_safe = rel->consider_parallel;
- pathnode->path.parallel_degree = 0;
+ pathnode->path.parallel_workers = 0;
pathnode->path.pathkeys = NIL; /* always unordered */
pathnode->bitmapqual = bitmapqual;
*/
pathnode->path.parallel_aware = false;
pathnode->path.parallel_safe = rel->consider_parallel;
- pathnode->path.parallel_degree = 0;
+ pathnode->path.parallel_workers = 0;
pathnode->path.pathkeys = NIL; /* always unordered */
*/
pathnode->path.parallel_aware = false;
pathnode->path.parallel_safe = rel->consider_parallel;
- pathnode->path.parallel_degree = 0;
+ pathnode->path.parallel_workers = 0;
pathnode->path.pathkeys = NIL; /* always unordered */
required_outer);
pathnode->path.parallel_aware = false;
pathnode->path.parallel_safe = rel->consider_parallel;
- pathnode->path.parallel_degree = 0;
+ pathnode->path.parallel_workers = 0;
pathnode->path.pathkeys = NIL; /* always unordered */
pathnode->tidquals = tidquals;
*/
AppendPath *
create_append_path(RelOptInfo *rel, List *subpaths, Relids required_outer,
- int parallel_degree)
+ int parallel_workers)
{
AppendPath *pathnode = makeNode(AppendPath);
ListCell *l;
required_outer);
pathnode->path.parallel_aware = false;
pathnode->path.parallel_safe = rel->consider_parallel;
- pathnode->path.parallel_degree = parallel_degree;
+ pathnode->path.parallel_workers = parallel_workers;
pathnode->path.pathkeys = NIL; /* result is always considered
* unsorted */
pathnode->subpaths = subpaths;
required_outer);
pathnode->path.parallel_aware = false;
pathnode->path.parallel_safe = rel->consider_parallel;
- pathnode->path.parallel_degree = 0;
+ pathnode->path.parallel_workers = 0;
pathnode->path.pathkeys = pathkeys;
pathnode->subpaths = subpaths;
pathnode->path.param_info = NULL; /* there are no other rels... */
pathnode->path.parallel_aware = false;
pathnode->path.parallel_safe = rel->consider_parallel;
- pathnode->path.parallel_degree = 0;
+ pathnode->path.parallel_workers = 0;
pathnode->path.pathkeys = NIL;
pathnode->quals = resconstantqual;
pathnode->path.parallel_aware = false;
pathnode->path.parallel_safe = rel->consider_parallel &&
subpath->parallel_safe;
- pathnode->path.parallel_degree = subpath->parallel_degree;
+ pathnode->path.parallel_workers = subpath->parallel_workers;
pathnode->path.pathkeys = subpath->pathkeys;
pathnode->subpath = subpath;
pathnode->path.parallel_aware = false;
pathnode->path.parallel_safe = rel->consider_parallel &&
subpath->parallel_safe;
- pathnode->path.parallel_degree = subpath->parallel_degree;
+ pathnode->path.parallel_workers = subpath->parallel_workers;
/*
* Assume the output is unsorted, since we don't necessarily have pathkeys
required_outer);
pathnode->path.parallel_aware = false;
pathnode->path.parallel_safe = false;
- pathnode->path.parallel_degree = subpath->parallel_degree;
+ pathnode->path.parallel_workers = subpath->parallel_workers;
pathnode->path.pathkeys = NIL; /* Gather has unordered result */
pathnode->subpath = subpath;
pathnode->single_copy = false;
- if (pathnode->path.parallel_degree == 0)
+ if (pathnode->path.parallel_workers == 0)
{
- pathnode->path.parallel_degree = 1;
+ pathnode->path.parallel_workers = 1;
pathnode->path.pathkeys = subpath->pathkeys;
pathnode->single_copy = true;
}
pathnode->path.parallel_aware = false;
pathnode->path.parallel_safe = rel->consider_parallel &&
subpath->parallel_safe;
- pathnode->path.parallel_degree = subpath->parallel_degree;
+ pathnode->path.parallel_workers = subpath->parallel_workers;
pathnode->path.pathkeys = pathkeys;
pathnode->subpath = subpath;
required_outer);
pathnode->parallel_aware = false;
pathnode->parallel_safe = rel->consider_parallel;
- pathnode->parallel_degree = 0;
+ pathnode->parallel_workers = 0;
pathnode->pathkeys = pathkeys;
cost_functionscan(pathnode, root, rel, pathnode->param_info);
required_outer);
pathnode->parallel_aware = false;
pathnode->parallel_safe = rel->consider_parallel;
- pathnode->parallel_degree = 0;
+ pathnode->parallel_workers = 0;
pathnode->pathkeys = NIL; /* result is always unordered */
cost_valuesscan(pathnode, root, rel, pathnode->param_info);
required_outer);
pathnode->parallel_aware = false;
pathnode->parallel_safe = rel->consider_parallel;
- pathnode->parallel_degree = 0;
+ pathnode->parallel_workers = 0;
pathnode->pathkeys = NIL; /* XXX for now, result is always unordered */
cost_ctescan(pathnode, root, rel, pathnode->param_info);
required_outer);
pathnode->parallel_aware = false;
pathnode->parallel_safe = rel->consider_parallel;
- pathnode->parallel_degree = 0;
+ pathnode->parallel_workers = 0;
pathnode->pathkeys = NIL; /* result is always unordered */
/* Cost is the same as for a regular CTE scan */
required_outer);
pathnode->path.parallel_aware = false;
pathnode->path.parallel_safe = rel->consider_parallel;
- pathnode->path.parallel_degree = 0;
+ pathnode->path.parallel_workers = 0;
pathnode->path.rows = rows;
pathnode->path.startup_cost = startup_cost;
pathnode->path.total_cost = total_cost;
pathnode->path.parallel_aware = false;
pathnode->path.parallel_safe = joinrel->consider_parallel &&
outer_path->parallel_safe && inner_path->parallel_safe;
- /* This is a foolish way to estimate parallel_degree, but for now... */
- pathnode->path.parallel_degree = outer_path->parallel_degree;
+ /* This is a foolish way to estimate parallel_workers, but for now... */
+ pathnode->path.parallel_workers = outer_path->parallel_workers;
pathnode->path.pathkeys = pathkeys;
pathnode->jointype = jointype;
pathnode->outerjoinpath = outer_path;
pathnode->jpath.path.parallel_aware = false;
pathnode->jpath.path.parallel_safe = joinrel->consider_parallel &&
outer_path->parallel_safe && inner_path->parallel_safe;
- /* This is a foolish way to estimate parallel_degree, but for now... */
- pathnode->jpath.path.parallel_degree = outer_path->parallel_degree;
+ /* This is a foolish way to estimate parallel_workers, but for now... */
+ pathnode->jpath.path.parallel_workers = outer_path->parallel_workers;
pathnode->jpath.path.pathkeys = pathkeys;
pathnode->jpath.jointype = jointype;
pathnode->jpath.outerjoinpath = outer_path;
pathnode->jpath.path.parallel_aware = false;
pathnode->jpath.path.parallel_safe = joinrel->consider_parallel &&
outer_path->parallel_safe && inner_path->parallel_safe;
- /* This is a foolish way to estimate parallel_degree, but for now... */
- pathnode->jpath.path.parallel_degree = outer_path->parallel_degree;
+ /* This is a foolish way to estimate parallel_workers, but for now... */
+ pathnode->jpath.path.parallel_workers = outer_path->parallel_workers;
/*
* A hashjoin never has pathkeys, since its output ordering is
pathnode->path.parallel_aware = false;
pathnode->path.parallel_safe = rel->consider_parallel &&
subpath->parallel_safe;
- pathnode->path.parallel_degree = subpath->parallel_degree;
+ pathnode->path.parallel_workers = subpath->parallel_workers;
/* Projection does not change the sort order */
pathnode->path.pathkeys = subpath->pathkeys;
pathnode->path.parallel_aware = false;
pathnode->path.parallel_safe = rel->consider_parallel &&
subpath->parallel_safe;
- pathnode->path.parallel_degree = subpath->parallel_degree;
+ pathnode->path.parallel_workers = subpath->parallel_workers;
pathnode->path.pathkeys = pathkeys;
pathnode->subpath = subpath;
pathnode->path.parallel_aware = false;
pathnode->path.parallel_safe = rel->consider_parallel &&
subpath->parallel_safe;
- pathnode->path.parallel_degree = subpath->parallel_degree;
+ pathnode->path.parallel_workers = subpath->parallel_workers;
/* Group doesn't change sort ordering */
pathnode->path.pathkeys = subpath->pathkeys;
pathnode->path.parallel_aware = false;
pathnode->path.parallel_safe = rel->consider_parallel &&
subpath->parallel_safe;
- pathnode->path.parallel_degree = subpath->parallel_degree;
+ pathnode->path.parallel_workers = subpath->parallel_workers;
/* Unique doesn't change the input ordering */
pathnode->path.pathkeys = subpath->pathkeys;
pathnode->path.parallel_aware = false;
pathnode->path.parallel_safe = rel->consider_parallel &&
subpath->parallel_safe;
- pathnode->path.parallel_degree = subpath->parallel_degree;
+ pathnode->path.parallel_workers = subpath->parallel_workers;
if (aggstrategy == AGG_SORTED)
pathnode->path.pathkeys = subpath->pathkeys; /* preserves order */
else
pathnode->path.parallel_aware = false;
pathnode->path.parallel_safe = rel->consider_parallel &&
subpath->parallel_safe;
- pathnode->path.parallel_degree = subpath->parallel_degree;
+ pathnode->path.parallel_workers = subpath->parallel_workers;
pathnode->subpath = subpath;
/*
pathnode->path.parallel_aware = false;
/* A MinMaxAggPath implies use of subplans, so cannot be parallel-safe */
pathnode->path.parallel_safe = false;
- pathnode->path.parallel_degree = 0;
+ pathnode->path.parallel_workers = 0;
/* Result is one unordered row */
pathnode->path.rows = 1;
pathnode->path.pathkeys = NIL;
pathnode->path.parallel_aware = false;
pathnode->path.parallel_safe = rel->consider_parallel &&
subpath->parallel_safe;
- pathnode->path.parallel_degree = subpath->parallel_degree;
+ pathnode->path.parallel_workers = subpath->parallel_workers;
/* WindowAgg preserves the input sort order */
pathnode->path.pathkeys = subpath->pathkeys;
pathnode->path.parallel_aware = false;
pathnode->path.parallel_safe = rel->consider_parallel &&
subpath->parallel_safe;
- pathnode->path.parallel_degree = subpath->parallel_degree;
+ pathnode->path.parallel_workers = subpath->parallel_workers;
/* SetOp preserves the input sort order if in sort mode */
pathnode->path.pathkeys =
(strategy == SETOP_SORTED) ? subpath->pathkeys : NIL;
pathnode->path.parallel_safe = rel->consider_parallel &&
leftpath->parallel_safe && rightpath->parallel_safe;
/* Foolish, but we'll do it like joins for now: */
- pathnode->path.parallel_degree = leftpath->parallel_degree;
+ pathnode->path.parallel_workers = leftpath->parallel_workers;
/* RecursiveUnion result is always unsorted */
pathnode->path.pathkeys = NIL;
pathnode->path.param_info = NULL;
pathnode->path.parallel_aware = false;
pathnode->path.parallel_safe = false;
- pathnode->path.parallel_degree = 0;
+ pathnode->path.parallel_workers = 0;
pathnode->path.rows = subpath->rows;
/*
pathnode->path.param_info = NULL;
pathnode->path.parallel_aware = false;
pathnode->path.parallel_safe = false;
- pathnode->path.parallel_degree = 0;
+ pathnode->path.parallel_workers = 0;
pathnode->path.pathkeys = NIL;
/*
pathnode->path.parallel_aware = false;
pathnode->path.parallel_safe = rel->consider_parallel &&
subpath->parallel_safe;
- pathnode->path.parallel_degree = subpath->parallel_degree;
+ pathnode->path.parallel_workers = subpath->parallel_workers;
pathnode->path.rows = subpath->rows;
pathnode->path.startup_cost = subpath->startup_cost;
pathnode->path.total_cost = subpath->total_cost;