From c9ce4a1c61ebf39c03885cc19fe7c32edc04a300 Mon Sep 17 00:00:00 2001 From: Robert Haas Date: Thu, 9 Jun 2016 09:08:27 -0400 Subject: [PATCH] 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). --- doc/src/sgml/config.sgml | 10 +-- doc/src/sgml/ref/create_table.sgml | 12 +-- doc/src/sgml/release-9.6.sgml | 2 +- src/backend/access/common/reloptions.c | 6 +- src/backend/nodes/outfuncs.c | 2 +- src/backend/optimizer/path/allpaths.c | 34 ++++---- src/backend/optimizer/path/costsize.c | 8 +- src/backend/optimizer/plan/createplan.c | 2 +- src/backend/optimizer/plan/planner.c | 6 +- src/backend/optimizer/util/pathnode.c | 86 +++++++++---------- src/backend/optimizer/util/plancat.c | 4 +- src/backend/optimizer/util/relnode.c | 2 +- src/backend/utils/misc/guc.c | 4 +- src/backend/utils/misc/postgresql.conf.sample | 2 +- src/bin/psql/tab-complete.c | 2 +- src/include/nodes/relation.h | 4 +- src/include/optimizer/cost.h | 2 +- src/include/optimizer/pathnode.h | 4 +- src/include/utils/rel.h | 6 +- 19 files changed, 99 insertions(+), 99 deletions(-) diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index 50f6d4ea7fd..4f93e7062dd 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -1998,16 +1998,16 @@ include_dir 'conf.d' - - max_parallel_degree (integer) + + max_parallel_workers_per_gather (integer) - max_parallel_degree configuration parameter + max_parallel_workers_per_gather configuration parameter - 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 + Gather node. Parallel workers are taken from the pool of processes established by . 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 d1807ed0dbf..06e6392f737 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 - parallel_degree (integer) + parallel_workers (integer) - 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 . + 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 . diff --git a/doc/src/sgml/release-9.6.sgml b/doc/src/sgml/release-9.6.sgml index 38e19672495..a14545d5d80 100644 --- a/doc/src/sgml/release-9.6.sgml +++ b/doc/src/sgml/release-9.6.sgml @@ -153,7 +153,7 @@ Use of parallel query execution can be controlled through the new configuration parameters - , + , , , and . diff --git a/src/backend/access/common/reloptions.c b/src/backend/access/common/reloptions.c index 7448c7f30fe..cdf074fc985 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 389808c9e95..c7b4153c030 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 873a7647748..546a01da5cb 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 b39c928eba1..e7f63f4faba 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 bd19f43d586..52df17fe694 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 b1554cb8390..ba0c0ecae9c 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 6182b362a3a..6b57de350d0 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 3a585ade747..04529faff41 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 1e87a7302ab..e2ebf479296 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 edfa39adf4a..14d20429101 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 2d2db7ed003..3ef2a9761cc 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 3b07726e574..cc10abc1c43 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 b1f6cf45f0b..88669f38765 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 d4adca6836a..f41f9e96098 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 acc827de488..5de4c34a2b7 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 5d354c0f67b..3d628766e51 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)) /* -- 2.30.2