Re: Partition prune with stable Expr

From: Andy Fan <zhihui(dot)fan1213(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: David Rowley <dgrowleyml(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Partition prune with stable Expr
Date: 2020-09-28 12:21:24
Message-ID: CAKU4AWqwv=RHc-_9UFWV9rFBFAx00iqsT6BUCsiVufZsZAeHuw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Sep 28, 2020 at 7:15 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Andy Fan <zhihui(dot)fan1213(at)gmail(dot)com> writes:
> > On Mon, Sep 28, 2020 at 4:46 AM David Rowley <dgrowleyml(at)gmail(dot)com>
> wrote:
> >> Thanks for showing an interest in partition pruning. Unfortunately,
> >> it's not possible to use stable functions to prune partitions during
> >> planning.
>
> > Sigh.. I understand you now, I ignored the plan can be cached for later
> use.
> > Without that, we should be able to prune with stable function.
>
> No, that's still wrong. The contract for a stable function is that
> its result won't change over execution of a single query; but that
> says *execution*, not *planning and execution*.
>

I have a slightly different opinion about the impact of "cached the plan
for later use will be wrong" now. Generic plan will never be partition
pruned plan since we don't know which partition to prune at plan time.
So for any cached plan, it is not a plan time partition pruned plan.
Partition prune with stable expr is still unacceptable even this is not
an issue but hope the snapshot issue will be the only one issue to
fix in future for this direction. I'd like to know if I am wrong again.

--
Best Regards
Andy Fan

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Christoph Berg 2020-09-28 12:22:01 Re: gs_group_1 crashing on 13beta2/s390x
Previous Message Dilip Kumar 2020-09-28 10:48:07 Re: Re: [HACKERS] Custom compression methods