Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 E-mail Us
 Oracle Articles
New Oracle Articles

 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog

 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Oracle Support

 SQL Tuning

 Oracle UNIX
 Oracle Linux
 Remote s
 Remote plans
 Application Server

 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S


 Consulting Staff
 Consulting Prices
 Help Wanted!


 Oracle Posters
 Oracle Books

 Oracle Scripts

Don Burleson Blog 







Why is Oracle not using my index?

Oracle Database Tips by Donald BurlesonApril 3, 2015

Question:  I just created a function-based index on a table and I was distressed to see that the cost-based optimizer is not using the highly selective index.  Why is Oracle not using my index?

Answer:  When your optimizer_mode is set to minimize response time (e.g. first_rows_1, first_rows_10, &c), you should always see Oracle using the most "selective" index, the indexes that will return the smallest number of rows.  First, we need to know a few details about your optimizer settings:

  • Query re-write: You need to set these parameters to get Oracle to use a function-based index:


  • optimizer_mode:  If you are using the default value of all_rows, the query my think that a full-table can is "better" than your function-based index.  Remember, the all_rows optimizer mode optimizes to minimize computing resources and favor full-scans over index scans.  Conversely, the first_rows_n optimizer_mode optimizes to minimize response time and favors index access.
  • table dbms_stats:  If your function-based index has not been fully analyzed by dbms_stats, the optimizer may be ignoring the index.  You need to re-analyze the target table with dbms_stats.  This will also re-analyze the indexes on the target table.
  • index dbms_stats:  A function based index can be ignored when you fail to create histograms on the function-based index.  See here using statistics for indexes
  • system dbms_stats  When Oracle is not using an index, it can also be helpful to run dbms_stats.gather_system_stats.
  • Bugs:  It is rare, but you may need to check Oracle technical support for bugs relating to index usage.  If you suspect a bug and you are in a test environment you can also issue the "alter system flush shared pool" command to re-initialize all SQL.
  • Other indexes:  You may have other indexes that Oracle perceives as being "better" for the query. 

In sum, the Oracle optimizer should immediately see a new index and begin using it immediately, invalidating all SQL that might benefit from the index.

Forcing Oracle to use an index

When Oracle does not use an index, you can force him to use the index with diagnostic tools.  Testing to force Oracle to use an index is easy.  We use the SQL*Plus "set autotrace on" and "set timing on" commands and time the queries, once with the default and again using an index hint. 

The "best" query for response time is usually the one that fetches the rows with the fewest consistent gets.  These are ONLY testing tools, but you will still need to find the reason my Oracle is ignoring your index and not using the index in your query.

  • index hint:  You can force Oracle to use your index with an index hint.
  • optimizer_index_cost_adj:  If you are already using cost-based optimization and you have already run system stats, try setting optimizer_index_cost_adj=10.  This will temporarily force the use of the index:

alter session set optimizer_index_cost_adj=10;.

Get the Complete
Oracle SQL Tuning Information 

The landmark book "Advanced Oracle SQL Tuning  The Definitive Reference"  is filled with valuable information on Oracle SQL Tuning. This book includes scripts and tools to hypercharge Oracle 11g performance and you can buy it for 30% off directly from the publisher.



Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


Copyright © 1996 -  2020

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.



Oracle Training at Sea
oracle dba poster

Follow us on Twitter 
Oracle performance tuning software 
Oracle Linux poster