What's faster - full outer join or sum a union
431101Jun 10 2005 — edited Nov 25 2007Hello,
what do you think it's the best way to bring two tables together? Full outer join (1) or sum over a union (2)?
1.
select a.id nvl(a.x,0) ,nvl(b.y,0) from
a full outer join b
where a.id=b.id
2.
select id, sun(x), sum(y) from
(select id, x,0 y from a
union all
select id, 0 x, y from b )
group by id;
The ids are primary keys and ca. 80% of ids in a are found in b and vice versa.
Both tables have about 20 mio datasets.
Thank for thinking about
Stephan