Re: Should we add GUCs to allow partition pruning to be disabled?
Amit Langote <langote_amit_f8@lab.ntt.co.jp>
From: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
To: David Rowley <david.rowley@2ndquadrant.com>,
Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2018-04-23T04:46:17Z
Lists: pgsql-hackers
Hi David. On 2018/04/21 14:09, David Rowley wrote: > On 20 April 2018 at 20:51, Amit Langote <Langote_Amit_f8@lab.ntt.co.jp> wrote: >> set constraint_exclusion to off; >> >> -- not ok! > > It needed a bit more effort than I put in the first time around to > make this work properly. constraint_exclusion = 'off' becomes a bit of > a special case for partitioned tables now. To make this work I had to > get rid of hasInheritedTarget and make a new enum that tracks if we're > inheritance planning for an inheritance parent or a partitioned table. > We can't simply only set hasInheritedTarget to true when planning with > inheritance parents as constraint_exclusion = 'partition' must still > know that we're planning using the inheritance planner. > > v2 patch attached. Thanks for the updated patch. Your proposed changes to inheritance_planner() look fine to me. In the comment added by the patch in relation_excluded_by_constraints(): + /* + * When constraint_exclusion is set to 'partition' we only handle + * OTHER_MEMBER_RELs, or BASERELs in cases where the result target is an + * inheritance parent or a partitioned table. + */ Just to clarify this a bit, would it be a good idea to be specific by appending " (see inheritance_planner() where this is determined)" or some such to this sentence? BTW, while we're at it, would it also be a good idea to consider the patch you had proposed, which I then posted an updated version of, to adjust the documentation in ddl.sgml (in the section 5.10. Table Partitioning) regarding the relationship between constraint exclusion and declarative partitioning? https://www.postgresql.org/message-id/c2838545-0e77-3c08-cd14-1c3bbf9eb62d%40lab.ntt.co.jp Thanks, Amit
Commits
-
Tweak partitioning documentation wording
- 12b9affb32a6 11.0 landed
-
docs: Rework sections on partition pruning/exclusion
- bebc46931a12 11.0 landed
-
Add GUC enable_partition_pruning
- 055fb8d33da6 11.0 landed