From 25fe8b5f1ac93c3ec01519854e4f554b2e57a926 Mon Sep 17 00:00:00 2001 From: Robert Haas Date: Fri, 8 Apr 2016 11:14:56 -0400 Subject: Add a 'parallel_degree' reloption. The code that estimates what parallel degree should be uesd for the scan of a relation is currently rather stupid, so add a parallel_degree reloption that can be used to override the planner's rather limited judgement. Julien Rouhaud, reviewed by David Rowley, James Sewell, Amit Kapila, and me. Some further hacking by me. --- src/include/nodes/relation.h | 1 + src/include/utils/rel.h | 9 +++++++++ 2 files changed, 10 insertions(+) (limited to 'src/include') diff --git a/src/include/nodes/relation.h b/src/include/nodes/relation.h index d430f6e9fd..e9dfb663c2 100644 --- a/src/include/nodes/relation.h +++ b/src/include/nodes/relation.h @@ -522,6 +522,7 @@ typedef struct RelOptInfo double allvisfrac; PlannerInfo *subroot; /* if subquery */ List *subplan_params; /* if subquery */ + int rel_parallel_degree; /* wanted number of parallel workers */ /* Information about foreign tables and foreign joins */ Oid serverid; /* identifies server for the table or join */ diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h index 51eb27a381..c7582c2a11 100644 --- a/src/include/utils/rel.h +++ b/src/include/utils/rel.h @@ -206,6 +206,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 */ } StdRdOptions; #define HEAP_MIN_FILLFACTOR 10 @@ -242,6 +243,14 @@ typedef struct StdRdOptions ((relation)->rd_options ? \ ((StdRdOptions *) (relation)->rd_options)->user_catalog_table : false) +/* + * RelationGetParallelDegree + * Returns the relation's parallel_degree. Note multiple eval of argument! + */ +#define RelationGetParallelDegree(relation, defaultpd) \ + ((relation)->rd_options ? \ + ((StdRdOptions *) (relation)->rd_options)->parallel_degree : (defaultpd)) + /* * ViewOptions -- cgit v1.2.3