I am a bit puzzled: I understand that the general experience is that outer joins are fast. Well, my case here is different: Need to add one field from the sds table to the drug table, based on one common key field:
select drug.*, sds.name
from drug
left outer join sds
on drug.id = sds.id;
Table sizes: drug 25,000 rows sds 65,000 rows matching 24,000 rows on field "id" Both tables are indexed on the id field
The first query above did not return a result after 2 minutes, then I aborted.
So I redid the query with a temporary table:
create temporary table tmp select *, space( 50) as name from drug;
create index id on tmp ( id);
update tmp, sds
set tmp.name = sds.name
where tmp.id = sds.id;
All this together took less than one second cpu time.
Does this make sense? she we avoid outer joins like the plague?