BUG #5165: Poor performance with Left-join where right side does not exist - Mailing list pgsql-bugs

From assaf
Subject BUG #5165: Poor performance with Left-join where right side does not exist
Date
Msg-id 200911041744.nA4Hi5l1028570@wwwmaster.postgresql.org
Whole thread Raw
Responses Re: BUG #5165: Poor performance with Left-join where right side does not exist  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
The following bug has been logged online:

Bug reference:      5165
Logged by:          assaf
Email address:      assaf_lehr@yahoo.com
PostgreSQL version: 8.37
Operating system:   linux
Description:        Poor performance with Left-join where right side does
not exist
Details:

A
category | idB | multiple-values

B
category | idB | multiple-values

--------------
select B.idB , A.idB from B left join A on B.idB = A.idB and
A.category=B.category
where A.idB is null [and A.category=202] limit 10
--------------
I have indexes on all columns and thier permutations.
I needed merge-join here and expected brief results ,as it is easy to find
not-nulls running on both indexes.
My DB is quite big (20M items) and the result was supposed to be 0.5M items.
I stopped waiting after 18 hours.

There is workaround , select B.idB from B where category=202 and idB not in
(select distinct idB from A where category=202);
It finishes in good time(10min) , but it`s totally a waste to use subplan
here.

pgsql-bugs by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: BUG #4961: pg_standby.exe crashes with no args
Next
From: Tom Lane
Date:
Subject: Re: BUG #5165: Poor performance with Left-join where right side does not exist