Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Making A "Hash" of it. Why are indexes not used?
-In this case it may be O.K. but note that converting an IN clause to
a
-JOIN may return wrong results.
-regards
-Srivenu
--how's that, Srivenu?
create table x(A number);
create table y(B number);
insert into x values(1); insert into x values(2); insert into x values(3); insert into y values(1); insert into y values(1);
A B
---------- ----------
1 1 1 1
A
1
You get right results only if the is a UNIQUE constraint on the column
B in table Y.
In fact Oracle unnests and rewrites the IN Sub query into a join if
the join is guaranteed to return the same data.
Please refer to this URL.
http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96533/opt_ops.htm#1005654
regards
Srivenu
Received on Fri Feb 27 2004 - 06:40:33 CST