Re: Problem with default partition pruning

From: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
To: Yuzuko Hosoya <hosoya(dot)yuzuko(at)lab(dot)ntt(dot)co(dot)jp>, "'Thibaut'" <thibaut(dot)madelaine(at)dalibo(dot)com>, "'Imai, Yoshikazu'" <imai(dot)yoshikazu(at)jp(dot)fujitsu(dot)com>
Cc: "'PostgreSQL Hackers'" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Problem with default partition pruning
Date: 2019-03-22 06:38:27
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


On 2019/03/22 15:02, Yuzuko Hosoya wrote:
> I understood Amit's proposal. But I think the issue Thibaut reported would
> occur regardless of whether clauses have OR clauses or not as follows.
> I tested a query which should output "One-Time Filter: false".
> # explain select * from test2_0_20 where id = 25;
> -----------------------------------------------------------------------
> Append (cost=0.00..25.91 rows=6 width=36)
> -> Seq Scan on test2_10_20_def (cost=0.00..25.88 rows=6 width=36)
> Filter: (id = 25)

Good catch, thanks.

> As Amit described in the previous email, id = 25 contradicts test2_0_20's
> partition constraint, so I think this clause should be ignored and we can
> also handle this case in the similar way as Amit proposal.
> I attached v1-delta-2.patch which fix the above issue.
> What do you think about it?

It looks fine to me. You put the code block to check whether a give
clause contradicts the partition constraint in its perfect place. :)

Maybe we should have two patches as we seem to be improving two things:

1. Patch to fix problems with default partition pruning originally
reported by Hosoya-san

2. Patch to determine if a given clause contradicts a sub-partitioned
table's partition constraint, fixing problems unearthed by Thibaut's tests

About the patch that Horiguchi-san proposed upthread, I think it has merit
that it will make partprune.c code easier to reason about, but I think we
should pursue it separately.


In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2019-03-22 06:45:37 Re: COPY FREEZE and setting PD_ALL_VISIBLE/visibility map bits
Previous Message Yuzuko Hosoya 2019-03-22 06:02:51 RE: Problem with default partition pruning