Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Long running sub-query: bug or feature
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.eduReceived on Thu Feb 05 1998 - 00:00:00 CST
![]() |
![]() |