Re: Runtime partition pruning

From: Radu Radutiu <rradutiu(at)gmail(dot)com>
To: Michael Lewis <mlewis(at)entrata(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Runtime partition pruning
Date: 2020-03-23 16:48:35
Message-ID: CAG4TxrjdAS0jAFgrrTbPurPtUOybrJgtmytdB92HhnkdepXQFQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks. Yes, the query with the same parameter seems to work as expected.
It doesn't help us though as we are trying to transparently support
partitioning using an ORM and we cannot change the parameters. Using the
column name would have been much easier.

Regards,
Radu

On Mon, Mar 23, 2020 at 5:56 PM Michael Lewis <mlewis(at)entrata(dot)com> wrote:

> select * from test where id between client_id-10 and client_id+10 and
>> client_id=?;
>>
>> does not (it scans all partitions in parallel) .
>> Is it expected?
>>
>
> Yes. But the below would work fine I expect since the planner would know a
> constant range for id. I would be very surprised if the optimizer had some
> condition rewrite rules to handle just the scenario you show.
>
> select * from test where id between ?-10 and ?+10 and client_id=?;
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Daniel Verite 2020-03-23 16:58:51 Re: Could postgres12 support millions of sequences? (like 10 million)
Previous Message Kouber Saparev 2020-03-23 16:39:40 Re: Is it safe to rename an index through pg_class update?