diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index 50f6d4ea7fdec55bec63415e2f853b956a450560..4f93e7062dd5935f1aef375bb0a4ebb0f10e6844 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -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 diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index d1807ed0dbfe7b24b87721f270dd1a153691ce0b..06e6392f73712aa7348cd0a4d3a0539e0af9cd55 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -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> diff --git a/doc/src/sgml/release-9.6.sgml b/doc/src/sgml/release-9.6.sgml index 38e1967249580e14e32909fd6b0032820c7161c5..a14545d5d80e20deadf927ce60cf256b4cf83bd4 100644 --- a/doc/src/sgml/release-9.6.sgml +++ b/doc/src/sgml/release-9.6.sgml @@ -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">. diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c index 7448c7f30fe4d530213e4a079ee2a75f22d05ad6..cdf074fc985025b42f70f07c5fa37bff3578c50c 100644 --- a/src/backend/access/common/reloptions.c +++ b/src/backend/access/common/reloptions.c @@ -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); diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c index 389808c9e9553b0ed1735546d4d96597f748a496..c7b4153c0308becb4364c896b6c648d91e567722 100644 --- a/src/backend/nodes/outfuncs.c +++ b/src/backend/nodes/outfuncs.c @@ -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"); diff --git a/src/backend/optimizer/path/allpaths.c b/src/backend/optimizer/path/allpaths.c index 873a76477484d4b41eaf7b2778b13c306fd71405..546a01da5cb6976d284c31ec338bf15941dc1efd 100644 --- a/src/backend/optimizer/path/allpaths.c +++ b/src/backend/optimizer/path/allpaths.c @@ -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); } diff --git a/src/backend/optimizer/path/costsize.c b/src/backend/optimizer/path/costsize.c index b39c928eba167c3d3541aba5600a736fbf75c79a..e7f63f4faba8da7947c435d66b67b8d7fe6c87d2 100644 --- a/src/backend/optimizer/path/costsize.c +++ b/src/backend/optimizer/path/costsize.c @@ -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; diff --git a/src/backend/optimizer/plan/createplan.c b/src/backend/optimizer/plan/createplan.c index bd19f43d586db497514c17630644788d0707a6d2..52df17fe69493c800563e98f4976fe1b3e81ce78 100644 --- a/src/backend/optimizer/plan/createplan.c +++ b/src/backend/optimizer/plan/createplan.c @@ -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); diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c index b1554cb8390373a64c4c57b25a1cecc9201fb51d..ba0c0ecae9c9386a7fb387267aed81c35b4fb2df 100644 --- a/src/backend/optimizer/plan/planner.c +++ b/src/backend/optimizer/plan/planner.c @@ -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, diff --git a/src/backend/optimizer/util/pathnode.c b/src/backend/optimizer/util/pathnode.c index 6182b362a3a92f71bf879e0df66cbab350c67446..6b57de350d00d4898af0821dd6e6fa92dd998b81 100644 --- a/src/backend/optimizer/util/pathnode.c +++ b/src/backend/optimizer/util/pathnode.c @@ -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; diff --git a/src/backend/optimizer/util/plancat.c b/src/backend/optimizer/util/plancat.c index 3a585ade747722791b1fda1b06e0d4b14c8c2e17..04529faff413f2d3eed2b96c1dacf1c16eba76c0 100644 --- a/src/backend/optimizer/util/plancat.c +++ b/src/backend/optimizer/util/plancat.c @@ -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. diff --git a/src/backend/optimizer/util/relnode.c b/src/backend/optimizer/util/relnode.c index 1e87a7302abfe393baf5427f09d146ca2056e7f4..e2ebf4792962770d9408a6414552d1757687deab 100644 --- a/src/backend/optimizer/util/relnode.c +++ b/src/backend/optimizer/util/relnode.c @@ -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; diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index edfa39adf4adf3a6e01d0457fedc8a0a387f95b0..14d204291012c066410463f1d247f34972ab616d 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -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 }, diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample index 2d2db7ed003531e8d9d695f4a66974d31aac46ef..3ef2a9761ccf448aadd8c85d55f79b5cb12f2294 100644 --- a/src/backend/utils/misc/postgresql.conf.sample +++ b/src/backend/utils/misc/postgresql.conf.sample @@ -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, diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c index 3b07726e5747703599f0405c489df5b58e40522c..cc10abc1c43a2c6b3c5b9ca5483119db9e25b40c 100644 --- a/src/bin/psql/tab-complete.c +++ b/src/bin/psql/tab-complete.c @@ -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", diff --git a/src/include/nodes/relation.h b/src/include/nodes/relation.h index b1f6cf45f0bdd0582133b325e639127fa075f065..88669f38765d9474a05dcad3a9a9fa77dc6969f1 100644 --- a/src/include/nodes/relation.h +++ b/src/include/nodes/relation.h @@ -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 */ diff --git a/src/include/optimizer/cost.h b/src/include/optimizer/cost.h index d4adca6836a30ead68c5299bd77da66d3ba34129..f41f9e960987b56abae261556dff363179b14caf 100644 --- a/src/include/optimizer/cost.h +++ b/src/include/optimizer/cost.h @@ -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; diff --git a/src/include/optimizer/pathnode.h b/src/include/optimizer/pathnode.h index acc827de488f7567fa368cdd7f6ec7dbd2241fb8..5de4c34a2b73c2fa26fd3541f8592ff1d66ac7f4 100644 --- a/src/include/optimizer/pathnode.h +++ b/src/include/optimizer/pathnode.h @@ -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, diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h index 5d354c0f67b33f1a69cd87d13cadaba6c8d2ca85..3d628766e51ad7f1f20775fc5051dae97a026e43 100644 --- a/src/include/utils/rel.h +++ b/src/include/utils/rel.h @@ -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)) /*