Eliminate "parallel degree" terminology.

This terminology provoked widespread complaints.  So, instead, rename
the GUC max_parallel_degree to max_parallel_workers_per_gather
(leaving room for a possible future GUC max_parallel_workers that acts
as a system-wide limit), and rename the parallel_degree reloption to
parallel_workers.  Rename structure members to match.

These changes create a dump/restore hazard for users of PostgreSQL
9.6beta1 who have set the reloption (or applied the GUC using ALTER
USER or ALTER DATABASE).
This commit is contained in:
Robert Haas 2016-06-09 09:08:27 -04:00
parent 6581e930a8
commit c9ce4a1c61
19 changed files with 99 additions and 99 deletions

View File

@ -1998,16 +1998,16 @@ include_dir 'conf.d'
</listitem>
</varlistentry>
<varlistentry id="guc-max-parallel-degree" xreflabel="max_parallel_degree">
<term><varname>max_parallel_degree</varname> (<type>integer</type>)
<varlistentry id="guc-max-parallel-workers-per-gather" xreflabel="max_parallel_workers_per_gather">
<term><varname>max_parallel_workers_per_gather</varname> (<type>integer</type>)
<indexterm>
<primary><varname>max_parallel_degree</> configuration parameter</primary>
<primary><varname>max_parallel_workers_per_gather</> configuration parameter</primary>
</indexterm>
</term>
<listitem>
<para>
Sets the maximum number of workers that can be started for an
individual parallel operation. Parallel workers are taken from the
Sets the maximum number of workers that can be started by a single
<literal>Gather</literal> node. Parallel workers are taken from the
pool of processes established by
<xref linkend="guc-max-worker-processes">. Note that the requested
number of workers may not actually be available at runtime. If this

View File

@ -909,14 +909,14 @@ CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED ] TABLE [ IF NOT EXI
</varlistentry>
<varlistentry>
<term><literal>parallel_degree</> (<type>integer</>)</term>
<term><literal>parallel_workers</> (<type>integer</>)</term>
<listitem>
<para>
The parallel degree for a table is the number of workers that should
be used to assist a parallel scan of that table. If not set, the
system will determine a value based on the relation size. The actual
number of workers chosen by the planner may be less, for example due to
the setting of <xref linkend="guc-max-parallel-degree">.
This sets the number of workers that should be used to assist a parallel
scan of this table. If not set, the system will determine a value based
on the relation size. The actual number of workers chosen by the planner
may be less, for example due to
the setting of <xref linkend="guc-max-worker-processes">.
</para>
</listitem>
</varlistentry>

View File

@ -153,7 +153,7 @@
<para>
Use of parallel query execution can be controlled through the new
configuration parameters
<xref linkend="guc-max-parallel-degree">,
<xref linkend="guc-max-parallel-workers-per-gather">,
<xref linkend="guc-force-parallel-mode">,
<xref linkend="guc-parallel-setup-cost">, and
<xref linkend="guc-parallel-tuple-cost">.

View File

@ -270,7 +270,7 @@ static relopt_int intRelOpts[] =
},
{
{
"parallel_degree",
"parallel_workers",
"Number of parallel processes that can be used per executor node for this relation.",
RELOPT_KIND_HEAP,
AccessExclusiveLock
@ -1301,8 +1301,8 @@ default_reloptions(Datum reloptions, bool validate, relopt_kind kind)
offsetof(StdRdOptions, autovacuum) +offsetof(AutoVacOpts, analyze_scale_factor)},
{"user_catalog_table", RELOPT_TYPE_BOOL,
offsetof(StdRdOptions, user_catalog_table)},
{"parallel_degree", RELOPT_TYPE_INT,
offsetof(StdRdOptions, parallel_degree)}
{"parallel_workers", RELOPT_TYPE_INT,
offsetof(StdRdOptions, parallel_workers)}
};
options = parseRelOptions(reloptions, validate, kind, &numoptions);

View File

@ -1609,7 +1609,7 @@ _outPathInfo(StringInfo str, const Path *node)
_outBitmapset(str, NULL);
WRITE_BOOL_FIELD(parallel_aware);
WRITE_BOOL_FIELD(parallel_safe);
WRITE_INT_FIELD(parallel_degree);
WRITE_INT_FIELD(parallel_workers);
WRITE_FLOAT_FIELD(rows, "%.0f");
WRITE_FLOAT_FIELD(startup_cost, "%.2f");
WRITE_FLOAT_FIELD(total_cost, "%.2f");

View File

@ -669,26 +669,26 @@ set_plain_rel_pathlist(PlannerInfo *root, RelOptInfo *rel, RangeTblEntry *rte)
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
{
@ -711,9 +711,9 @@ create_plain_partial_paths(PlannerInfo *root, RelOptInfo *rel)
* 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;
@ -721,7 +721,7 @@ create_plain_partial_paths(PlannerInfo *root, RelOptInfo *rel)
}
/* 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));
}
/*
@ -1242,11 +1242,11 @@ set_append_rel_pathlist(PlannerInfo *root, RelOptInfo *rel,
{
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.
*/
@ -1254,13 +1254,13 @@ set_append_rel_pathlist(PlannerInfo *root, RelOptInfo *rel,
{
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);
}

View File

@ -113,7 +113,7 @@ int effective_cache_size = DEFAULT_EFFECTIVE_CACHE_SIZE;
Cost disable_cost = 1.0e10;
int max_parallel_degree = 2;
int max_parallel_workers_per_gather = 2;
bool enable_seqscan = true;
bool enable_indexscan = true;
@ -229,9 +229,9 @@ cost_seqscan(Path *path, PlannerInfo *root,
cpu_run_cost += path->pathtarget->cost.per_tuple * path->rows;
/* Adjust costing for parallelism, if used. */
if (path->parallel_degree > 0)
if (path->parallel_workers > 0)
{
double parallel_divisor = path->parallel_degree;
double parallel_divisor = path->parallel_workers;
double leader_contribution;
/*
@ -245,7 +245,7 @@ cost_seqscan(Path *path, PlannerInfo *root,
* estimate that the leader spends 30% of its time servicing each
* worker, and the remainder executing the parallel plan.
*/
leader_contribution = 1.0 - (0.3 * path->parallel_degree);
leader_contribution = 1.0 - (0.3 * path->parallel_workers);
if (leader_contribution > 0)
parallel_divisor += leader_contribution;

View File

@ -1394,7 +1394,7 @@ create_gather_plan(PlannerInfo *root, GatherPath *best_path)
gather_plan = make_gather(tlist,
NIL,
best_path->path.parallel_degree,
best_path->path.parallel_workers,
best_path->single_copy,
subplan);

View File

@ -245,7 +245,7 @@ standard_planner(Query *parse, int cursorOptions, ParamListInfo boundParams)
glob->parallelModeOK = (cursorOptions & CURSOR_OPT_PARALLEL_OK) != 0 &&
IsUnderPostmaster && dynamic_shared_memory_type != DSM_IMPL_NONE &&
parse->commandType == CMD_SELECT && !parse->hasModifyingCTE &&
parse->utilityStmt == NULL && max_parallel_degree > 0 &&
parse->utilityStmt == NULL && max_parallel_workers_per_gather > 0 &&
!IsParallelWorker() && !IsolationIsSerializable() &&
!has_parallel_hazard((Node *) parse, true);
@ -3622,7 +3622,7 @@ create_grouping_paths(PlannerInfo *root,
if (grouped_rel->partial_pathlist)
{
Path *path = (Path *) linitial(grouped_rel->partial_pathlist);
double total_groups = path->rows * path->parallel_degree;
double total_groups = path->rows * path->parallel_workers;
path = (Path *) create_gather_path(root,
grouped_rel,
@ -3717,7 +3717,7 @@ create_grouping_paths(PlannerInfo *root,
if (hashaggtablesize < work_mem * 1024L)
{
double total_groups = path->rows * path->parallel_degree;
double total_groups = path->rows * path->parallel_workers;
path = (Path *) create_gather_path(root,
grouped_rel,

View File

@ -941,7 +941,7 @@ add_partial_path_precheck(RelOptInfo *parent_rel, Cost total_cost,
*/
Path *
create_seqscan_path(PlannerInfo *root, RelOptInfo *rel,
Relids required_outer, int parallel_degree)
Relids required_outer, int parallel_workers)
{
Path *pathnode = makeNode(Path);
@ -950,9 +950,9 @@ create_seqscan_path(PlannerInfo *root, RelOptInfo *rel,
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);
@ -976,7 +976,7 @@ create_samplescan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer
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);
@ -1033,7 +1033,7 @@ create_index_path(PlannerInfo *root,
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 */
@ -1082,7 +1082,7 @@ create_bitmap_heap_path(PlannerInfo *root,
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;
@ -1118,7 +1118,7 @@ create_bitmap_and_path(PlannerInfo *root,
*/
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 */
@ -1154,7 +1154,7 @@ create_bitmap_or_path(PlannerInfo *root,
*/
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 */
@ -1183,7 +1183,7 @@ create_tidscan_path(PlannerInfo *root, RelOptInfo *rel, List *tidquals,
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;
@ -1203,7 +1203,7 @@ create_tidscan_path(PlannerInfo *root, RelOptInfo *rel, List *tidquals,
*/
AppendPath *
create_append_path(RelOptInfo *rel, List *subpaths, Relids required_outer,
int parallel_degree)
int parallel_workers)
{
AppendPath *pathnode = makeNode(AppendPath);
ListCell *l;
@ -1215,7 +1215,7 @@ create_append_path(RelOptInfo *rel, List *subpaths, Relids required_outer,
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;
@ -1274,7 +1274,7 @@ create_merge_append_path(PlannerInfo *root,
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;
@ -1357,7 +1357,7 @@ create_result_path(PlannerInfo *root, RelOptInfo *rel,
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;
@ -1398,7 +1398,7 @@ create_material_path(RelOptInfo *rel, Path *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;
pathnode->path.pathkeys = subpath->pathkeys;
pathnode->subpath = subpath;
@ -1463,7 +1463,7 @@ create_unique_path(PlannerInfo *root, RelOptInfo *rel, Path *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
@ -1681,15 +1681,15 @@ create_gather_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath,
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;
}
@ -1718,7 +1718,7 @@ create_subqueryscan_path(PlannerInfo *root, RelOptInfo *rel, Path *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;
pathnode->path.pathkeys = pathkeys;
pathnode->subpath = subpath;
@ -1745,7 +1745,7 @@ create_functionscan_path(PlannerInfo *root, RelOptInfo *rel,
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);
@ -1771,7 +1771,7 @@ create_valuesscan_path(PlannerInfo *root, RelOptInfo *rel,
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);
@ -1796,7 +1796,7 @@ create_ctescan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer)
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);
@ -1822,7 +1822,7 @@ create_worktablescan_path(PlannerInfo *root, RelOptInfo *rel,
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 */
@ -1861,7 +1861,7 @@ create_foreignscan_path(PlannerInfo *root, RelOptInfo *rel,
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;
@ -2001,8 +2001,8 @@ create_nestloop_path(PlannerInfo *root,
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;
@ -2064,8 +2064,8 @@ create_mergejoin_path(PlannerInfo *root,
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;
@ -2126,8 +2126,8 @@ create_hashjoin_path(PlannerInfo *root,
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
@ -2177,7 +2177,7 @@ create_projection_path(PlannerInfo *root,
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;
@ -2303,7 +2303,7 @@ create_sort_path(PlannerInfo *root,
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;
@ -2348,7 +2348,7 @@ create_group_path(PlannerInfo *root,
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;
@ -2405,7 +2405,7 @@ create_upper_unique_path(PlannerInfo *root,
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;
@ -2464,7 +2464,7 @@ create_agg_path(PlannerInfo *root,
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
@ -2532,7 +2532,7 @@ create_groupingsets_path(PlannerInfo *root,
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;
/*
@ -2647,7 +2647,7 @@ create_minmaxagg_path(PlannerInfo *root,
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;
@ -2705,7 +2705,7 @@ create_windowagg_path(PlannerInfo *root,
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;
@ -2773,7 +2773,7 @@ create_setop_path(PlannerInfo *root,
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;
@ -2833,7 +2833,7 @@ create_recursiveunion_path(PlannerInfo *root,
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;
@ -2871,7 +2871,7 @@ create_lockrows_path(PlannerInfo *root, RelOptInfo *rel,
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;
/*
@ -2942,7 +2942,7 @@ create_modifytable_path(PlannerInfo *root, RelOptInfo *rel,
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;
/*
@ -3029,7 +3029,7 @@ create_limit_path(PlannerInfo *root, RelOptInfo *rel,
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;

View File

@ -128,8 +128,8 @@ get_relation_info(PlannerInfo *root, Oid relationObjectId, bool inhparent,
estimate_rel_size(relation, rel->attr_widths - rel->min_attr,
&rel->pages, &rel->tuples, &rel->allvisfrac);
/* Retrive the parallel_degree reloption, if set. */
rel->rel_parallel_degree = RelationGetParallelDegree(relation, -1);
/* Retrive the parallel_workers reloption, if set. */
rel->rel_parallel_workers = RelationGetParallelDegree(relation, -1);
/*
* Make list of indexes. Ignore indexes on system catalogs if told to.

View File

@ -107,7 +107,7 @@ build_simple_rel(PlannerInfo *root, int relid, RelOptKind reloptkind)
rel->consider_startup = (root->tuple_fraction > 0);
rel->consider_param_startup = false; /* might get changed later */
rel->consider_parallel = false; /* might get changed later */
rel->rel_parallel_degree = -1; /* set up in GetRelationInfo */
rel->rel_parallel_workers = -1; /* set up in GetRelationInfo */
rel->reltarget = create_empty_pathtarget();
rel->pathlist = NIL;
rel->ppilist = NIL;

View File

@ -2648,11 +2648,11 @@ static struct config_int ConfigureNamesInt[] =
},
{
{"max_parallel_degree", PGC_USERSET, RESOURCES_ASYNCHRONOUS,
{"max_parallel_workers_per_gather", PGC_USERSET, RESOURCES_ASYNCHRONOUS,
gettext_noop("Sets the maximum number of parallel processes per executor node."),
NULL
},
&max_parallel_degree,
&max_parallel_workers_per_gather,
2, 0, 1024,
NULL, NULL, NULL
},

View File

@ -167,7 +167,7 @@
#effective_io_concurrency = 1 # 1-1000; 0 disables prefetching
#max_worker_processes = 8 # (change requires restart)
#max_parallel_degree = 2 # max number of worker processes per node
#max_parallel_workers_per_gather = 2 # taken from max_worker_processes
#old_snapshot_threshold = -1 # 1min-60d; -1 disables; 0 is immediate
# (change requires restart)
#backend_flush_after = 0 # 0 disables,

View File

@ -1784,7 +1784,7 @@ psql_completion(const char *text, int start, int end)
"autovacuum_vacuum_scale_factor",
"autovacuum_vacuum_threshold",
"fillfactor",
"parallel_degree",
"parallel_workers",
"log_autovacuum_min_duration",
"toast.autovacuum_enabled",
"toast.autovacuum_freeze_max_age",

View File

@ -521,7 +521,7 @@ typedef struct RelOptInfo
double allvisfrac;
PlannerInfo *subroot; /* if subquery */
List *subplan_params; /* if subquery */
int rel_parallel_degree; /* wanted number of parallel workers */
int rel_parallel_workers; /* wanted number of parallel workers */
/* Information about foreign tables and foreign joins */
Oid serverid; /* identifies server for the table or join */
@ -850,7 +850,7 @@ typedef struct Path
bool parallel_aware; /* engage parallel-aware logic? */
bool parallel_safe; /* OK to use as part of parallel plan? */
int parallel_degree; /* desired parallel degree; 0 = not parallel */
int parallel_workers; /* desired # of workers; 0 = not parallel */
/* estimated size/costs for path (see costsize.c for more info) */
double rows; /* estimated number of result tuples */

View File

@ -54,7 +54,7 @@ extern PGDLLIMPORT double parallel_tuple_cost;
extern PGDLLIMPORT double parallel_setup_cost;
extern PGDLLIMPORT int effective_cache_size;
extern Cost disable_cost;
extern int max_parallel_degree;
extern int max_parallel_workers_per_gather;
extern bool enable_seqscan;
extern bool enable_indexscan;
extern bool enable_indexonlyscan;

View File

@ -34,7 +34,7 @@ extern bool add_partial_path_precheck(RelOptInfo *parent_rel,
Cost total_cost, List *pathkeys);
extern Path *create_seqscan_path(PlannerInfo *root, RelOptInfo *rel,
Relids required_outer, int parallel_degree);
Relids required_outer, int parallel_workers);
extern Path *create_samplescan_path(PlannerInfo *root, RelOptInfo *rel,
Relids required_outer);
extern IndexPath *create_index_path(PlannerInfo *root,
@ -62,7 +62,7 @@ extern BitmapOrPath *create_bitmap_or_path(PlannerInfo *root,
extern TidPath *create_tidscan_path(PlannerInfo *root, RelOptInfo *rel,
List *tidquals, Relids required_outer);
extern AppendPath *create_append_path(RelOptInfo *rel, List *subpaths,
Relids required_outer, int parallel_degree);
Relids required_outer, int parallel_workers);
extern MergeAppendPath *create_merge_append_path(PlannerInfo *root,
RelOptInfo *rel,
List *subpaths,

View File

@ -204,7 +204,7 @@ typedef struct StdRdOptions
AutoVacOpts autovacuum; /* autovacuum-related options */
bool user_catalog_table; /* use as an additional catalog
* relation */
int parallel_degree; /* max number of parallel workers */
int parallel_workers; /* max number of parallel workers */
} StdRdOptions;
#define HEAP_MIN_FILLFACTOR 10
@ -243,11 +243,11 @@ typedef struct StdRdOptions
/*
* RelationGetParallelDegree
* Returns the relation's parallel_degree. Note multiple eval of argument!
* Returns the relation's parallel_workers. Note multiple eval of argument!
*/
#define RelationGetParallelDegree(relation, defaultpd) \
((relation)->rd_options ? \
((StdRdOptions *) (relation)->rd_options)->parallel_degree : (defaultpd))
((StdRdOptions *) (relation)->rd_options)->parallel_workers : (defaultpd))
/*