Force Index Use in Oracle

Force index use in Oracle

You can use optimizer hints

select /*+ INDEX(table_name index_name) */ from table etc...

More on using optimizer hints:
http://download.oracle.com/docs/cd/B19306_01/server.102/b14211/hintsref.htm

How to force oracle to not to use an index

use NO_INDEX hint

http://docs.oracle.com/cd/B19306_01/server.102/b14200/sql_elements006.htm#BABHJBIB

for instance

SELECT /*+ NO_INDEX(t1 id1) */ 
FROM t1,
t2
WHERE t1.id = t2.id;

Force oracle to use index

No. And if the optimizer doesn't use the index, it usually has a good reason for it. Index usage, if the index is poor, can actually slow your queries down.



Related Topics



Leave a reply



Submit