aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/misc
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2018-07-16 13:35:41 +0200
committerPeter Eisentraut <peter_e@gmx.net>2018-07-16 13:35:41 +0200
commitf7cb2842bf47715133b40e4a503f35dbe60d1b72 (patch)
tree645468d969635b10cb87e1134b60afcd26456339 /src/backend/utils/misc
parenta06e56b247feb2812bad5cf60fd9c0128d81f5c0 (diff)
downloadpostgresql-f7cb2842bf47715133b40e4a503f35dbe60d1b72.tar.gz
postgresql-f7cb2842bf47715133b40e4a503f35dbe60d1b72.zip
Add plan_cache_mode setting
This allows overriding the choice of custom or generic plan. Author: Pavel Stehule <pavel.stehule@gmail.com> Discussion: https://www.postgresql.org/message-id/flat/CAFj8pRAGLaiEm8ur5DWEBo7qHRWTk9HxkuUAz00CZZtJj-LkCA%40mail.gmail.com
Diffstat (limited to 'src/backend/utils/misc')
-rw-r--r--src/backend/utils/misc/guc.c19
-rw-r--r--src/backend/utils/misc/postgresql.conf.sample1
2 files changed, 20 insertions, 0 deletions
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 17292e04fed..a88ea6cfc9e 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -405,6 +405,13 @@ static const struct config_enum_entry force_parallel_mode_options[] = {
{NULL, 0, false}
};
+static const struct config_enum_entry plan_cache_mode_options[] = {
+ {"auto", PLAN_CACHE_MODE_AUTO, false},
+ {"force_generic_plan", PLAN_CACHE_MODE_FORCE_GENERIC_PLAN, false},
+ {"force_custom_plan", PLAN_CACHE_MODE_FORCE_CUSTOM_PLAN, false},
+ {NULL, 0, false}
+};
+
/*
* password_encryption used to be a boolean, so accept all the likely
* variants of "on", too. "off" used to store passwords in plaintext,
@@ -4150,6 +4157,18 @@ static struct config_enum ConfigureNamesEnum[] =
NULL, NULL, NULL
},
+ {
+ {"plan_cache_mode", PGC_USERSET, QUERY_TUNING_OTHER,
+ gettext_noop("Controls the planner's selection of custom or generic plan."),
+ gettext_noop("Prepared statements can have custom and generic plans, and the planner "
+ "will attempt to choose which is better. This can be set to override "
+ "the default behavior.")
+ },
+ &plan_cache_mode,
+ PLAN_CACHE_MODE_AUTO, plan_cache_mode_options,
+ NULL, NULL, NULL
+ },
+
/* End-of-list marker */
{
{NULL, 0, 0, NULL, NULL}, NULL, 0, NULL, NULL, NULL, NULL
diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample
index 657c3f81f8f..c0d3fb84911 100644
--- a/src/backend/utils/misc/postgresql.conf.sample
+++ b/src/backend/utils/misc/postgresql.conf.sample
@@ -350,6 +350,7 @@
#join_collapse_limit = 8 # 1 disables collapsing of explicit
# JOIN clauses
#force_parallel_mode = off
+#plan_cache_mode = auto
#------------------------------------------------------------------------------