RE: Problem with default partition pruning

From: "Yuzuko Hosoya" <hosoya(dot)yuzuko(at)lab(dot)ntt(dot)co(dot)jp>
To: "'Kyotaro HORIGUCHI'" <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
Cc: <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>, <thibaut(dot)madelaine(at)dalibo(dot)com>, <imai(dot)yoshikazu(at)jp(dot)fujitsu(dot)com>, <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: RE: Problem with default partition pruning
Date: 2019-04-09 07:41:47
Message-ID: 00cf01d4eea7$afa43370$0eec9a50$@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Horiguchi-san,

Thanks for your comments.

> -----Original Message-----
> From: Kyotaro HORIGUCHI [mailto:horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp]
> Sent: Tuesday, April 09, 2019 10:33 AM
> To: hosoya(dot)yuzuko(at)lab(dot)ntt(dot)co(dot)jp
> Cc: Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp; thibaut(dot)madelaine(at)dalibo(dot)com; imai(dot)yoshikazu(at)jp(dot)fujitsu(dot)com;
> pgsql-hackers(at)lists(dot)postgresql(dot)org
> Subject: Re: Problem with default partition pruning
>
> Sigh..
>
> At Tue, 09 Apr 2019 10:28:48 +0900 (Tokyo Standard Time), Kyotaro HORIGUCHI
> <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp> wrote in
> <20190409(dot)102848(dot)252476604(dot)horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
> > As the second thought. Partition constraint is not constraint
> > expression so that's fair to apply partqual ignoring
> > constraint_exclusion. The variable is set false to skip useless
> > expression evaluation on all partitions, but partqual should be
> > evaluated just once. Sorry for my confusion.
> >
> > So still it is wrong that the new code is added in
> > gen_partprune_steps_internal.
>
> So still it is wrong that the new code is added at the beginning of the loop on clauses in
> gen_partprune_steps_internal.
>
> > If partqual results true and the clause
> > is long, the partqual is evaluated uselessly at every recursion.
> >
> > Maybe we should do that when we find that the current clause doesn't
> > match part attributes. Specifically just after the for loop "for (i =
> > 0 ; i < part_scheme->partnattrs; i++)".
>
I think we should check whether WHERE clause contradicts partition
constraint even when the clause matches part attributes. So I moved
"if (partqual)" block to the beginning of the loop you mentioned.

I'm attaching the latest version. Could you please check it again?

Best regards,
Yuzuko Hosoya

Attachment Content-Type Size
v4_ignore_contradictory_where_clauses_at_partprune_step.patch application/octet-stream 4.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Haribabu Kommi 2019-04-09 07:46:56 Re: MSVC Build support with visual studio 2019
Previous Message Peter Eisentraut 2019-04-09 07:34:38 Re: [PATCH v20] GSSAPI encryption support