Re: why partition pruning doesn't work?

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>
Cc: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>, Dmitry Dolgov <9erthalion6(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: why partition pruning doesn't work?
Date: 2018-06-05 15:29:55
Message-ID: CAFj8pRAp5xpibtLgzAH9am0iDrZqD8vT2ybgOGHNKGV8zrjD0w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2018-06-05 17:07 GMT+02:00 David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>:

> On 5 June 2018 at 22:31, Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
> wrote:
> > Maybe, David (added to cc) has something to say about all this,
> especially
> > whether he considers this a feature and not a bug fix.
>
> Thanks, Amit. I had missed this thread.
>
> Yeah. I admit if I'd thought about this case when I wrote the code,
> then I'd have made any non-volatile Expr work, but I didn't :-(
>
> It was pointed out to be a few months ago in a comment in [1]. I
> initially thought that this was v12 material, but it seems there are a
> few people here that are pretty unhappy about it.
>
> I was going to describe what such a patch should look like here, but
> that seemed like about as much work as writing it, so:
>
> Please see the attached patch. I've only just finished with it and
> it's not fully done yet as there's still an XXX comment where I've not
> quite thought about Exprs with Vars from higher levels. These might
> always be converted to Params, so the code might be okay as is, but
> I've not checked this yet, hence the comment remains.
>
> I'm slightly leaning towards this being included in v11. Without this
> people are forced into hacks like WHERE partkey = (SELECT
> stablefunc()); to get pruning working at all. If that SQL remains
> after this patch then pruning can only take place during actual
> execution. With the attached patch the pruning can take place during
> the initialization of the executor, which in cases with many
> partitions can be significantly faster, providing actual execution is
> short. I'd rather people didn't get into bad habits like that if we
> can avoid it.
>

This is really great

Regards

Pavel

> [1] https://blog.2ndquadrant.com/partition-elimination-postgresql-11/
>
> --
> David Rowley http://www.2ndQuadrant.com/
> PostgreSQL Development, 24x7 Support, Training & Services
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Joshua D. Drake 2018-06-05 15:33:22 Re: Code of Conduct plan
Previous Message Joshua D. Drake 2018-06-05 15:29:43 Re: Code of Conduct plan