Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: How to force the use of an index ?

Re: How to force the use of an index ?

From: Chris Hamilton <ToneCzar_at_erols.com>
Date: Thu, 07 Oct 1999 09:10:14 -0400
Message-ID: <Jpv8N87utzuSOgYNmuNZjDxKQBeK@4ax.com>


On Thu, 7 Oct 1999 12:00:12 +0200, "Jean-Daniel TOULY" <jdtouly_at_staffandline.com> wrote:

>I want to force a SQL command to use an index because ORACLE doesn't choose
>to use it and give me long responses times.
>
>Optimizer goal is choose and statistics are applied on both table and index.
>
>The filed for the order is set for all the records of the table.
>
>the command I use is
>
>select /*+ INDEX(MATERIEL MATRIEL_FK19)*/ * from MATERIEL order by
>CODE_MATERIEL

>but the explain plan results in :
>
> 0 SELECT STATEMENT Optimizer=CHOOSE (Cost=1047 Card=20953 Byte
> s=5950652)
>
> 1 0 SORT (ORDER BY)
> 2 1 TABLE ACCESS (FULL) OF 'MATERIEL' (Cost=138 Card=20953 B
> ytes=5950652)
>
>
>Does anyone know why the index is nerver used, even when I force it ?
>
>Or why the index is not used at all with the ORDER BY sequence ?

If your SELECT statement given above is verbatim, then you may want to check the spelling of the index name ...

Your table is called MATERIEL, but your index is listed as MATERIEL_MATRIEL_FK19. Is is possible that there is a missing "E" in the index name?

If so, Oracle will ignore the hint as it will not be able to locate an index by that name.

Chris



Christopher Hamilton
Oracle DBA -- Sandbox.com
chamilton_at_sandbox-inc.com
http://www.sandbox.com/ Received on Thu Oct 07 1999 - 08:10:14 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US