{"Entry":{"collection":"guc","key":"enable_partition_pruning","name":"enable_partition_pruning","aliases":[],"metadata":{"baseline":false,"boot_human":"Not specified","boot_val":null,"category":"Query Tuning / Planner Method Configuration","category_zh":"","changed_in":["12","14"],"changes":[{"documentation_changed":false,"fields":{},"from":"10","status":"added","to":"11"},{"documentation_changed":true,"fields":{"short_desc":{"from":"Enable plan-time and run-time partition pruning.","to":"Enables plan-time and run-time partition pruning."}},"from":"11","status":"changed","to":"12"},{"documentation_changed":false,"fields":{"short_desc":{"from":"Enables plan-time and run-time partition pruning.","to":"Enables plan-time and execution-time partition pruning."}},"from":"13","status":"changed","to":"14"},{"documentation_changed":true,"fields":{},"from":"16","status":"changed","to":"17"},{"documentation_changed":true,"fields":{},"from":"18","status":"changed","to":"19"}],"content_hash":"ede7712b0ec774e769a83bdbd50de8fa79c3847f99474bc38e36c6d095e1288b","context":"","default_changed_in":[],"default_history":[{"from":"11","to":"19","value":"on"}],"editorial":{"advice":{"olap":"Benchmark representative analytical plans with and without enable_partition_pruning. Judge planning time, memory, spill, and execution time together; a win for one report is not evidence for a global setting.","oltp":"Keep the upstream default for routine OLTP. Use a transaction- or session-local change to diagnose whether choosing plan-time and execution-time elimination of partitions contradicted by query predicates explains a regression, then repair statistics, indexes, estimates, or query shape instead of leaving a cluster-wide method ban.","small":"Do not use enable_partition_pruning as a permanent hint on a small host. Resource pressure may change the best method, so verify with EXPLAIN (ANALYZE, BUFFERS) and keep the change scoped to the affected workload if it is still needed."},"mechanism":["enable_partition_pruning controls whether the planner may choose plan-time and execution-time elimination of partitions contradicted by query predicates.","It is consulted while a plan is built. A session-level change is useful for comparing EXPLAIN alternatives, but an already cached plan is not retroactively rewritten; invalidation or replanning is required to observe a different choice.","The switch changes which candidate paths the planner may cost; it does not make the chosen method faster by itself. Its user context permits session- or transaction-local changes; newly performed or newly planned work sees the value."],"pitfalls":["Treating enable_partition_pruning as a query hint even though it affects every plan built in its scope.","Testing an already cached prepared plan and concluding that the setting has no effect.","Masking stale statistics or cardinality errors by disabling a plan method globally.","The switch changes which candidate paths the planner may cost; it does not make the chosen method faster by itself."],"references":[{"title":"PostgreSQL 19 Beta 4: enable_partition_pruning","url":"https://www.postgresql.org/docs/19/runtime-config-query.html#GUC-ENABLE-PARTITION-PRUNING"},{"title":"PostgreSQL 19 release notes","url":"https://www.postgresql.org/docs/19/release-19.html"}],"related":["constraint_exclusion","enable_partitionwise_join","enable_partitionwise_aggregate","plan_cache_mode"],"summary":"enable_partition_pruning — Enables plan-time and execution-time partition pruning. Observed in PG11–19 Beta 4; its last measured boot default is on in PG19 Beta 4, with user context. This is a beta-snapshot fact and can change before PostgreSQL 19 GA."},"enumvals":[],"first_version":"11","group":"Query Tuning","group_slug":"query","imported_at":"2026-09-27T17:57:31.224393+08:00","intro_commit":{"authored_at":"2018-04-23T17:57:43-03:00","discussion":["https://postgr.es/m/CAKJS1f_0HwsxJG9m+nzU+CizxSdGtfe6iF_ykPYBiYft302DCw@mail.gmail.com"],"hash":"055fb8d33da6ff9003e3da4b9944bdcd2e2b2a49","subject":"Add GUC enable_partition_pruning","url":"https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=055fb8d33da6ff9003e3da4b9944bdcd2e2b2a49"},"key":"enable_partition_pruning","last_version":"20","max_val":"","min_val":"","name":"enable_partition_pruning","position":130,"present_in":["11","12","13","14","15","16","17","18","19","20"],"short_desc":"Enables or disables the query planner's ability to eliminate a partitioned table's partitions from query plans.","short_desc_zh":"","source_rev":"english-manuals:d56f8eb51418179cd24b865b34e9c1e4341bb2a766c1645cfc351b2bba178542","unit":"","vartype":"bool"}},"Definition":{"Collection":"guc","Key":"enable_partition_pruning","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"enable_partition_pruning","SourceRevision":"english-manuals:d56f8eb51418179cd24b865b34e9c1e4341bb2a766c1645cfc351b2bba178542","Facts":{"boot_val":"on","category":"Query Tuning / Planner Method Configuration","context":"user","description":"Enables or disables the query planner's ability to eliminate a partitioned table's partitions from query plans. This also controls the planner's ability to generate query plans which allow the query executor to remove (ignore) partitions during query execution. The default is on. See Section 5.12.4 for details.","doc":{"anchor":"GUC-ENABLE-PARTITION-PRUNING","file":"runtime-config-query.html","lang":"en","sha256":"33456ca7ef52bf28e93e34b932a411db7a1b95800179add2cf867dc6ec9144bc","slug":"18"},"documented":true,"enumvals":null,"extra_desc":"Allows the query planner and executor to compare partition bounds to conditions in the query to determine which partitions must be scanned.","lang":"en","max_val":null,"metadata_version":"18","min_val":null,"name":"enable_partition_pruning","short_desc":"Enables plan-time and execution-time partition pruning.","source":"pg-settings-source-snapshot","unit":null,"vartype":"bool"},"ManualEvidence":{"doc":{"anchor":"GUC-ENABLE-PARTITION-PRUNING","file":"runtime-config-query.html","lang":"en","sha256":"33456ca7ef52bf28e93e34b932a411db7a1b95800179add2cf867dc6ec9144bc","slug":"18"}},"MeasuredEvidence":{"metadata_version":"18"}},"Text":{"Collection":"guc","Key":"enable_partition_pruning","SourceDatabase":"pgweb","Version":"18","Locale":"zh-Hans","Title":"enable_partition_pruning","Summary":"","BodyHTML":"\u003cp\u003e允许或者禁止查询规划器从查询计划中消除一个分区表的分区。这也控制着规划器产生允许执行器在查询执行期间移除（忽略）分区的查询计划的能力。默认值是\u003ccode\u003eon\u003c/code\u003e。详情请参考\u003ca href=\"/docs/18/ddl-partitioning.html#DDL-PARTITION-PRUNING\" rel=\"nofollow\"\u003e第 5.12.4 节\u003c/a\u003e。\u003c/p\u003e","SourceRevision":"2026-09-11@29c86d9","ContentHash":"bb30f2aafd44eaa6e13df610cdd91ecd6e2c9e861e24d53ae0ca35a403239c6a","Payload":{"carried_from":"","carry_reason":"","doc_html":"\u003cp\u003e允许或者禁止查询规划器从查询计划中消除一个分区表的分区。这也控制着规划器产生允许执行器在查询执行期间移除（忽略）分区的查询计划的能力。默认值是\u003ccode class=\"literal\"\u003eon\u003c/code\u003e。详情请参考\u003ca href=\"/docs/18/ddl-partitioning.html#DDL-PARTITION-PRUNING\" title=\"5.12.4. 分区剪枝\"\u003e第 5.12.4 节\u003c/a\u003e。\u003c/p\u003e","doc_same_as":""}},"RequestedLocale":"zh-Hans","Fallback":false,"Versions":["11","12","13","14","15","16","17","18","19","20"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
