Re: Runtime partition pruning

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

>
> 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andres Freund 2020-03-23 16:23:03 Re: PG12 autovac issues
Previous Message Adrian Klaver 2020-03-23 15:31:36 Re: Loading 500m json files to database