Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Long running sub-query: bug or feature

Long running sub-query: bug or feature

From: Kelly Young <young_at_maricopa.edu>
Date: 1998/02/05
Message-ID: <34D9F9BD.4AD@maricopa.edu>#1/1

Any idea why a query will use the correct index when run standalone; but will use an incorrect index when executed as a sub-query? We have a query similar to this:

select ...

   from table_a
   where col1 = 12345 and col2 in

      (select col2
          from table_a
          where col1 = 12345
          group by col2
          having sum(col3) != 0);

Table_a has an index on col1 and an index on col2. When the above sql statement is run, the execution plan for the sub-query incorrectly uses the index on col2. When the sub-query is run standalone, it correctly uses the index on col1. Is this a bug or a feature? We are running rdbms 7.1.6 and use the rule based optimizer.

-- 
Kelly Young
Database Administrator
Maricopa Community Colleges
young_at_maricopa.edu
Received on Thu Feb 05 1998 - 00:00:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US