On Wed, 26 May 2021 at 11:38, Nagaraj Raj <nagaraj.sf@xxxxxxxxx> 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