Re: Problem with default partition pruning

From: Amit Langote <amitlangote09(at)gmail(dot)com>
To: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Simon Riggs <simon(at)2ndquadrant(dot)com>, yuzuko <yuzukohosoya(at)gmail(dot)com>, shawn wang <shawn(dot)wang(dot)pg(at)gmail(dot)com>, Shawn Wang <shawn(dot)wang(at)highgo(dot)ca>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Problem with default partition pruning
Date: 2019-08-09 05:02:36
Message-ID: CA+HiwqGm18B8UQ5Sip_nsNYmDiHtoaVORvCPumo_bbXTXHPRBw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Aug 9, 2019 at 1:17 PM Amit Langote <amitlangote09(at)gmail(dot)com> wrote:
> On Fri, Aug 9, 2019 at 12:09 PM Kyotaro Horiguchi
> <horikyota(dot)ntt(at)gmail(dot)com> wrote:
> > At Thu, 8 Aug 2019 14:50:54 +0900, Amit Langote wrote:
> > > When working on it, I realized
> > > that the way RelOptInfo.partition_qual is processed is a bit
> > > duplicative, so I created a separate patch to make that a bit more
> > > consistent.
> >
> > 0001 seems reasonable. By the way, the patch doesn't touch
> > get_relation_constraints(), but I suppose it can use the modified
> > partition constraint qual already stored in rel->partition_qual
> > in set_relation_partition_info. And we could move constifying to
> > set_rlation_partition_info?
>
> Ah, good advice. This make partition constraint usage within the
> planner quite a bit more consistent.

Hmm, oops. I think that judgement was a bit too rushed on my part. I
unintentionally ended up making the partition constraint to *always*
be fetched, whereas we don't need it in most cases. I've reverted
that change. RelOptInfo.partition_qual is poorly named in retrospect.
:( It's not set for all partitions, only those that are partitioned
themselves.

Attached updated patches.

Thanks,
Amit

Attachment Content-Type Size
v3-0001-Improve-RelOptInfo.partition_qual-usage.patch application/octet-stream 4.3 KB
v3-0002-Improve-constraint-exclusion-usage-in-partprune.c.patch application/octet-stream 2.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Craig Ringer 2019-08-09 05:34:21 Re: Global temporary tables
Previous Message Michael Paquier 2019-08-09 04:34:56 Re: Regression test failure in regression test temp.sql