Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

What's faster - full outer join or sum a union

431101Jun 10 2005 — edited Nov 25 2007
Hello,
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


Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 23 2007
Added on Jun 10 2005
4 comments
1,664 views