Re: issue partition scan

2021-05-25 Thread Christophe Pettus
> On May 25, 2021, at 17:16, David Rowley wrote: > > 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. The OP might consider rewriting the query as a UNION, wit

Re: issue partition scan

2021-05-25 Thread David Rowley
On Wed, 26 May 2021 at 11:38, Nagaraj Raj 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 = '

Re: issue partition scan

2021-05-25 Thread Nagaraj Raj
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

Re: issue partition scan

2021-05-25 Thread Christophe Pettus
> On May 25, 2021, at 15:50, Nagaraj Raj wrote: > > SELECT > t2.cid_hash AS BILLG_ACCT_CID_HASH , > t2.proxy_id AS INDVDL_ENTITY_PROXY_ID , > t2.accs_mthd AS ACCS_MTHD_CID_HASH > FROM > public.sub t2 > Inner join acc t3 on t3.cid_hash = t2.cid_hash > Left join

issue partition scan

2021-05-25 Thread Nagaraj Raj
I have a table 'sub_soc' with 3BIL records, it's been partitioned and indexed on the soc column. when the user is running a query with left join on this table and joining some other tables, the query planner doing a full table scan instead of looking into partitioned tables and index scan.  SEL