Subject | Finding Intersect of 2 Tables |
---|---|
Author | Maurice Ling |
Post date | 2006-11-06T04:20:47Z |
Hi,
I have a situation where I need to find the intersection of two or
more tables.
For example,
create table pn (u1 char(30), u2 char(30), value numeric(3,3));
create table cw (u1 char(30), u2 char(30), value numeric(3,3));
I need to find the set of (u1, u2) where it appears in both tables.
pn and cw tables are experimental data from external sources.
For each tuple of (u1, u2) in both tables, the "value" may be
different but that is not the issue.
What is the best indexing scheme and method for doing this intersection?
My current way is
select pn.u1, pn.u2 from pn join cw on pn.u1=cw.u1 and pn.u2=cw.u2;
Are there better means?
Thanks
Cheers
maurice
I have a situation where I need to find the intersection of two or
more tables.
For example,
create table pn (u1 char(30), u2 char(30), value numeric(3,3));
create table cw (u1 char(30), u2 char(30), value numeric(3,3));
I need to find the set of (u1, u2) where it appears in both tables.
pn and cw tables are experimental data from external sources.
For each tuple of (u1, u2) in both tables, the "value" may be
different but that is not the issue.
What is the best indexing scheme and method for doing this intersection?
My current way is
select pn.u1, pn.u2 from pn join cw on pn.u1=cw.u1 and pn.u2=cw.u2;
Are there better means?
Thanks
Cheers
maurice