{"Entry":{"collection":"guc","key":"enable_partitionwise_join","name":"enable_partitionwise_join","aliases":[],"metadata":{"baseline":false,"boot_human":"Not specified","boot_val":null,"category":"Query Tuning / Planner Method Configuration","category_zh":"","changed_in":[],"changes":[{"documentation_changed":false,"fields":{},"from":"10","status":"added","to":"11"},{"documentation_changed":true,"fields":{},"from":"11","status":"changed","to":"12"},{"documentation_changed":true,"fields":{},"from":"12","status":"changed","to":"13"}],"content_hash":"e3943b6fb0f20504c67f5e56587fa5e0cca4bd53aba5ad415eb8a5996d8f7e47","context":"","default_changed_in":[],"default_history":[{"from":"11","to":"19","value":"off"}],"editorial":{"advice":{"olap":"Compare planning memory, planning time, total execution memory, and partition count—not execution time alone.","oltp":"Keep the upstream default off for routine OLTP. Test on at session scope only when both sides have one-to-one compatible partition layouts and the join includes every partition key; budget planning CPU and the work_mem-limited nodes created per partition.","small":"Leave off unless a specific partition-aligned join repeatedly benefits. Many partitions can make planning and per-node memory disproportionate on a small host even when each local join is efficient."},"mechanism":["enable_partitionwise_join controls whether the planner may choose joining one-to-one matching partitions when join keys contain compatible partition keys.","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.","It can multiply work_mem-limited nodes and planning effort roughly with the number of participating partitions. Its user context permits session- or transaction-local changes; newly performed or newly planned work sees the value."],"pitfalls":["Treating enable_partitionwise_join 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.","It can multiply work_mem-limited nodes and planning effort roughly with the number of participating partitions."],"references":[{"title":"PostgreSQL 19 Beta 4: enable_partitionwise_join","url":"https://www.postgresql.org/docs/19/runtime-config-query.html#GUC-ENABLE-PARTITIONWISE-JOIN"},{"title":"PostgreSQL 19 release notes","url":"https://www.postgresql.org/docs/19/release-19.html"}],"related":["enable_partitionwise_aggregate","enable_partition_pruning","work_mem","join_collapse_limit","max_parallel_workers_per_gather"],"summary":"enable_partitionwise_join — Enables partitionwise join. Observed in PG11–19 Beta 4; its last measured boot default is off 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.2312+08:00","intro_commit":{"authored_at":"2018-02-16T10:33:59-05:00","discussion":["https://www.postgresql.org/message-id/flat/ad24e4f4-6481-066e-e3fb-6ef4a3121882%402ndquadrant.com"],"hash":"2fb1abaeb016aeb45b9e6d0b81b7a7e92bb251b9","subject":"Rename enable_partition_wise_join to enable_partitionwise_join","url":"https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=2fb1abaeb016aeb45b9e6d0b81b7a7e92bb251b9"},"key":"enable_partitionwise_join","last_version":"20","max_val":"","min_val":"","name":"enable_partitionwise_join","position":132,"present_in":["11","12","13","14","15","16","17","18","19","20"],"short_desc":"Enables or disables the query planner's use of partitionwise join, which allows a join between partitioned tables to be performed by joining the matching partitions.","short_desc_zh":"","source_rev":"english-manuals:60868092e88cb183ac529bd5aaa7be256e4855c6a0e975bc3b2c7dc6ceabe54b","unit":"","vartype":"bool"}},"Definition":{"Collection":"guc","Key":"enable_partitionwise_join","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"enable_partitionwise_join","SourceRevision":"english-manuals:60868092e88cb183ac529bd5aaa7be256e4855c6a0e975bc3b2c7dc6ceabe54b","Facts":{"boot_val":"off","category":"Query Tuning / Planner Method Configuration","context":"user","description":"Enables or disables the query planner's use of partitionwise join, which allows a join between partitioned tables to be performed by joining the matching partitions. Partitionwise join currently applies only when the join conditions include all the partition keys, which must be of the same data type and have one-to-one matching sets of child partitions. With this setting enabled, the number of nodes whose memory usage is restricted by work_mem appearing in the final plan can increase linearly according to the number of partitions being scanned. This can result in a large increase in overall memory consumption during the execution of the query. Query planning also becomes significantly more expensive in terms of memory and CPU. The default value is off.","doc":{"anchor":"GUC-ENABLE-PARTITIONWISE-JOIN","file":"runtime-config-query.html","lang":"en","sha256":"33456ca7ef52bf28e93e34b932a411db7a1b95800179add2cf867dc6ec9144bc","slug":"18"},"documented":true,"enumvals":null,"extra_desc":null,"lang":"en","max_val":null,"metadata_version":"18","min_val":null,"name":"enable_partitionwise_join","short_desc":"Enables partitionwise join.","source":"pg-settings-source-snapshot","unit":null,"vartype":"bool"},"ManualEvidence":{"doc":{"anchor":"GUC-ENABLE-PARTITIONWISE-JOIN","file":"runtime-config-query.html","lang":"en","sha256":"33456ca7ef52bf28e93e34b932a411db7a1b95800179add2cf867dc6ec9144bc","slug":"18"}},"MeasuredEvidence":{"metadata_version":"18"}},"Text":{"Collection":"guc","Key":"enable_partitionwise_join","SourceDatabase":"center","Version":"18","Locale":"en","Title":"enable_partitionwise_join","Summary":"Enables or disables the query planner's use of partitionwise join, which allows a join between partitioned tables to be performed by joining the matching partitions. Partitionwise join currently applies only when the join conditions include all the partition keys, which must be of the same data type and have one-to-one matching sets of child partitions. With this setting enabled, the number of nodes whose memory usage is restricted by work_mem appearing in the final plan can increase linearly according to the number of partitions being scanned. This can result in a large increase in overall memory consumption during the execution of the query. Query planning also becomes significantly more expensive in terms of memory and CPU. The default value is off.","BodyHTML":"\u003cp\u003eEnables or disables the query planner\u0026#39;s use of partitionwise join, which allows a join between partitioned tables to be performed by joining the matching partitions. Partitionwise join currently applies only when the join conditions include all the partition keys, which must be of the same data type and have one-to-one matching sets of child partitions. With this setting enabled, the number of nodes whose memory usage is restricted by work_mem appearing in the final plan can increase linearly according to the number of partitions being scanned. This can result in a large increase in overall memory consumption during the execution of the query. Query planning also becomes significantly more expensive in terms of memory and CPU. The default value is off.\u003c/p\u003e","SourceRevision":"english-manuals:60868092e88cb183ac529bd5aaa7be256e4855c6a0e975bc3b2c7dc6ceabe54b","ContentHash":"9fd59f3aa506ba702cf32bc533702df6dbcfc017ef95c0f8062ddc6d5c2acc0a","Payload":{"description":"Enables or disables the query planner's use of partitionwise join, which allows a join between partitioned tables to be performed by joining the matching partitions. Partitionwise join currently applies only when the join conditions include all the partition keys, which must be of the same data type and have one-to-one matching sets of child partitions. With this setting enabled, the number of nodes whose memory usage is restricted by work_mem appearing in the final plan can increase linearly according to the number of partitions being scanned. This can result in a large increase in overall memory consumption during the execution of the query. Query planning also becomes significantly more expensive in terms of memory and CPU. The default value is off."}},"RequestedLocale":"zh-Hans","Fallback":true,"Versions":["11","12","13","14","15","16","17","18","19","20"],"Locales":["en"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
