Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Join vs. Subselect
Hi,
Here is the situation. The application coded a query that looks like this:
select * from table1
where objid in (select objid from table2);
There is an index on objid in table 1 that isn't being used. An explain shows it is using this system view vw_nso_1 that is used to transform an IN subquery to a join. If you recode the query to:
select a.* from table1 a, table2 b
where a.objid = b.objid;
Then it will use the index. My question is: shouldn't it use the index in both cases. I know the join is a better way to code it and I have told the application that, but I would think that the first way would use an index anyway. Ideas?
Bill Carle
AT&T
Database Administrator
816-995-3922
wcarle_at_att.com
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Carle, William T (Bill), ALCAS
INET: wcarle_at_att.com
Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services ---------------------------------------------------------------------To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Mon Nov 11 2002 - 10:23:35 CST