1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-14 08:21:07 +03:00

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.
This commit is contained in:
Robert Haas
2016-04-08 11:14:56 -04:00
parent b0b64f6505
commit 25fe8b5f1a
8 changed files with 87 additions and 24 deletions

View File

@ -26,6 +26,7 @@
#include "commands/tablespace.h"
#include "commands/view.h"
#include "nodes/makefuncs.h"
#include "postmaster/postmaster.h"
#include "utils/array.h"
#include "utils/attoptcache.h"
#include "utils/builtins.h"
@ -267,6 +268,15 @@ static relopt_int intRelOpts[] =
0, 0, 0
#endif
},
{
{
"parallel_degree",
"Number of parallel processes that can be used per executor node for this relation.",
RELOPT_KIND_HEAP,
AccessExclusiveLock
},
-1, 0, MAX_BACKENDS
},
/* list terminator */
{{NULL}}
@ -1251,8 +1261,7 @@ fillRelOptions(void *rdopts, Size basesize,
/*
* Option parser for anything that uses StdRdOptions (i.e. fillfactor and
* autovacuum)
* Option parser for anything that uses StdRdOptions.
*/
bytea *
default_reloptions(Datum reloptions, bool validate, relopt_kind kind)
@ -1291,7 +1300,9 @@ default_reloptions(Datum reloptions, bool validate, relopt_kind kind)
{"autovacuum_analyze_scale_factor", RELOPT_TYPE_REAL,
offsetof(StdRdOptions, autovacuum) +offsetof(AutoVacOpts, analyze_scale_factor)},
{"user_catalog_table", RELOPT_TYPE_BOOL,
offsetof(StdRdOptions, user_catalog_table)}
offsetof(StdRdOptions, user_catalog_table)},
{"parallel_degree", RELOPT_TYPE_INT,
offsetof(StdRdOptions, parallel_degree)}
};
options = parseRelOptions(reloptions, validate, kind, &numoptions);