diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2009-01-07 22:40:49 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2009-01-07 22:40:49 +0000 |
commit | 445ce15702f701423a0fed3defe3a43662c7cd8d (patch) | |
tree | f2b79c75d8be22098f0f7c093127b133755de22a /src/backend/utils/misc/guc.c | |
parent | 12dcf7bb7552386c7a18d8a30b176718eb51c00e (diff) | |
download | postgresql-445ce15702f701423a0fed3defe3a43662c7cd8d.tar.gz postgresql-445ce15702f701423a0fed3defe3a43662c7cd8d.zip |
Create a third option named "partition" for constraint_exclusion, and make it
the default. This setting enables constraint exclusion checks only for
appendrel members (ie, inheritance children and UNION ALL arms), which are
the cases in which constraint exclusion is most likely to be useful. Avoiding
the overhead for simple queries that are unlikely to benefit should bring
the cost down to the point where this is a reasonable default setting.
Per today's discussion.
Diffstat (limited to 'src/backend/utils/misc/guc.c')
-rw-r--r-- | src/backend/utils/misc/guc.c | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index 479279cdc43..22cfbff6105 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -10,7 +10,7 @@ * Written by Peter Eisentraut <peter_e@gmx.net>. * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.490 2009/01/06 16:39:52 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.491 2009/01/07 22:40:49 tgl Exp $ * *-------------------------------------------------------------------- */ @@ -312,6 +312,23 @@ static const struct config_enum_entry backslash_quote_options[] = { }; /* + * Although only "on", "off", and "partition" are documented, we + * accept all the likely variants of "on" and "off". + */ +static const struct config_enum_entry constraint_exclusion_options[] = { + {"partition", CONSTRAINT_EXCLUSION_PARTITION, false}, + {"on", CONSTRAINT_EXCLUSION_ON, false}, + {"off", CONSTRAINT_EXCLUSION_OFF, false}, + {"true", CONSTRAINT_EXCLUSION_ON, true}, + {"false", CONSTRAINT_EXCLUSION_OFF, true}, + {"yes", CONSTRAINT_EXCLUSION_ON, true}, + {"no", CONSTRAINT_EXCLUSION_OFF, true}, + {"1", CONSTRAINT_EXCLUSION_ON, true}, + {"0", CONSTRAINT_EXCLUSION_OFF, true}, + {NULL, 0, false} +}; + +/* * Options for enum values stored in other modules */ extern const struct config_enum_entry sync_method_options[]; @@ -636,15 +653,6 @@ static struct config_bool ConfigureNamesBool[] = true, NULL, NULL }, { - {"constraint_exclusion", PGC_USERSET, QUERY_TUNING_OTHER, - gettext_noop("Enables the planner to use constraints to optimize queries."), - gettext_noop("Child table scans will be skipped if their " - "constraints guarantee that no rows match the query.") - }, - &constraint_exclusion, - false, NULL, NULL - }, - { {"geqo", PGC_USERSET, QUERY_TUNING_GEQO, gettext_noop("Enables genetic query optimization."), gettext_noop("This algorithm attempts to do planning without " @@ -2522,6 +2530,17 @@ static struct config_enum ConfigureNamesEnum[] = }, { + {"constraint_exclusion", PGC_USERSET, QUERY_TUNING_OTHER, + gettext_noop("Enables the planner to use constraints to optimize queries."), + gettext_noop("Table scans will be skipped if their constraints" + " guarantee that no rows match the query.") + }, + &constraint_exclusion, + CONSTRAINT_EXCLUSION_PARTITION, constraint_exclusion_options, + NULL, NULL + }, + + { {"default_transaction_isolation", PGC_USERSET, CLIENT_CONN_STATEMENT, gettext_noop("Sets the transaction isolation level of each new transaction."), NULL |