Oracle FAQ Your Portal to the Oracle Knowledge Grid

Home -> Community -> Usenet -> c.d.o.server -> Re: Index not getting used

Re: Index not getting used

From: Jonathan Lewis <>
Date: Mon, 28 Nov 2005 09:15:39 +0000 (UTC)
Message-ID: <dmehrr$i1h$>

"Parvez" <> wrote in message
> Hi All,
> I am having situation where my below query is not using index on
> updated date column, I have index on two date columns, created date and
> updated date, the query under focus has a OR condition with both the
> columns, the query execution is very high (full table scan) as below.
> If I just use created date it picks corresponding index and query
> execution time is very less. The tables are analyzed.
> Putting a Ordered by hint is better then no hint but still is not as
> good as Rule hint, why is it so, I want to avoid putting a Rule hint

Ultimately the answer to your question will be either:

    the statistics are misleading

    there is a transformation rule that currently blocks     what you perceive to be the best execution plan.

Regarding your index() hint - you will probably have to put in several other hints to ensure that the optimizer follows the path you expect. It is perfectly feasible for the optimizer to find an execution path that makes your hint illegal (or, more likely, out of context).

Since the rule based optimizer finds an efficient path using concatenation, you need to tell the cost based optimizer to use concatenation - at a minimum, you will need a /*+ use_concat */ hint. However, you may find that you still need to include other hints to make this produce exactly the path you want.

Run the following:

    create or replace outline XXX on
    select /*+ rule */ .....

    select * from user_outline_hints
    where name = 'XXX';

Look at the hints where STAGE = 3
This is the set of hints that the optimizer thinks is necessary to replay that path through the CBO.

You may find that you also see a couple of different values for column NODE, and a few hints (typically NOREWRITE) for stages 1 and 2. Multiple nodes may make it harder to use the stored hints.


Jonathan Lewis
The Co-operative Oracle Users' FAQ
Cost Based Oracle: Fundamentals
Public Appearances - schedule updated 4th Nov 2005
Received on Mon Nov 28 2005 - 03:15:39 CST

Original text of this message