Home » SQL & PL/SQL » SQL & PL/SQL » Bypassing the index
Bypassing the index [message #221769] Wed, 28 February 2007 06:16 Go to next message
Messages: 194
Registered: January 2006
Senior Member
If I have a query that uses an index in the explain plan, where the indexed column is a part of the 'where' clause, is it possible to bypass the index? I mean one way is to use a NO_INDEX hint or FULL hint. But without using hints, is there any other way? Like modifying the 'where' clause perhaps?? This is an interview question so you see, this situation may not even happen in real life applications.
Re: Bypassing the index [message #221771 is a reply to message #221769] Wed, 28 February 2007 06:19 Go to previous message
Messages: 7880
Registered: March 2000
Senior Member
There are ways to prevent the optimizer from using the index. One way is to create a function on the indexed column, e.g. add +0 for numeric columns or ||'' for varchar2 columns.
Downside of this is that you might hide important info for the optimizer (like cardinality), so these should be used with care.
A better way is to find out why the index is used, when you thing it should not be.
Previous Topic: where we are using like this sql statemnet ----->>select 1 from table name
Next Topic: Question about working with a "default" schema
Goto Forum:

Current Time: Sun Oct 23 11:22:30 CDT 2016

Total time taken to generate the page: 0.26697 seconds