Re: issue partition scan - Mailing list pgsql-performance

From David Rowley
Subject Re: issue partition scan
Date
Msg-id CAApHDvq3=UjNN5wP+z6pCxhXZAbsWXOaPLUck6DZve54KH=rOg@mail.gmail.com
Whole thread Raw
In response to Re: issue partition scan  (Nagaraj Raj <nagaraj.sf@yahoo.com>)
Responses Re: issue partition scan
List pgsql-performance
On Wed, 26 May 2021 at 11:38, Nagaraj Raj <nagaraj.sf@yahoo.com> wrote:
>
> Apologies,  I didn't understand you completely.
>
> > 1. Those that have sub_soc.soc = 'NFWJYW0' and sub_soc.curr_ind = 'Y'
>
> > It can use constraint exclusion on these to only scan applicable partitions.
>
> > 2. Those that have (acc.acct = 'I' AND acc.acct_sub IN  ( '4', '5' ) )  OR sub.ban IN  (
'00','01','02','03','04','05')
 
>
> > It can't use constraint exclusion on these since results can come from any partition.
>
> Why is it not using constraint exclusion on the above two conditions(1 and 2) included in the where clause ?
>
> Both sets are pointing to different tables.

It's because of the OR condition.  If it was an AND condition then the
planner wouldn't have to consider the fact that records in other
partitions might be required for the join.

David



pgsql-performance by date:

Previous
From: Nagaraj Raj
Date:
Subject: Re: issue partition scan
Next
From: Christophe Pettus
Date:
Subject: Re: issue partition scan