Re: Hash Right join and seq scan

2024-07-02 Thread James Pang
the join is "left out join" James Pang 於 2024年7月3日週三 下午2:51寫道: > > the query is >select >from table b join table aa >on b.partitionkeyid=aa.partitionkeyid >where b.id1= $1 and b.id2=$2 and b.rtime between $3 and $4; > > looks like optimizer try to "calcul

Re: Hash Right join and seq scan

2024-07-02 Thread James Pang
the query is select from table b join table aa on b.partitionkeyid=aa.partitionkeyid where b.id1= $1 and b.id2=$2 and b.rtime between $3 and $4; looks like optimizer try to "calculate cost for nestloop for scanning all partitions of tablexxx (32 hash partitions) "

Hash Right join and seq scan

2024-07-02 Thread James Pang
Both tables are hash partition tables , and we have a left out join , optimizer convert to Hash Right Join, but it always try to seq scan on tablexxx 32 paritions. there are almost 250k rows per parition for table , so it's slow. As a workaround, I disable hashjoin the it run much fast with