Re: Should we add GUCs to allow partition pruning to be disabled?

From: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>, Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Should we add GUCs to allow partition pruning to be disabled?
Date: 2018-04-21 05:09:29
Message-ID: CAKJS1f_0HwsxJG9m+nzU+CizxSdGtfe6iF_ykPYBiYft302DCw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thank you both of you for looking at this.

On 21 April 2018 at 06:28, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> wrote:
> + {"enable_partition_pruning", PGC_USERSET, QUERY_TUNING_METHOD,
> + gettext_noop("Enables the planner's ability to remove non-required partitions from the query plan."),
> + NULL
> + },
> + &enable_partition_pruning,
> + true,
> + NULL, NULL, NULL
> + },
>
> I would make the short description shorter, and use the long description
> to elaborate. So gettext_noop("Enable plan-time and run-time partition
> pruning.")
> followed by something like
>
> gettext_noop("Allows the query planner and executor to compare partition
> bounds to conditions in the query, and determine which partitions {can be
> skipped | must be scanned} ...")

I've taken a slight variation of this, but instead of ", and" I used
"to" and went with the "must be scanned" option.

select * from pg_settings where name like 'enable%'; does show that
this is the only enable_* GUC to have a long description, but perhaps
that does not matter.

On 20 April 2018 at 20:51, Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)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.

--
David Rowley http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

Attachment Content-Type Size
v2-0001-Add-GUC-to-allow-partition-pruning-to-be-disabled.patch application/octet-stream 20.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Gourav Kumar 2018-04-21 11:14:36 Memory Leaks in query_planner in postgresql 9.4 version
Previous Message Pavel Stehule 2018-04-21 03:35:33 proposal: force slow part of plpgsql compilation