Re: force use of an index - how to?

From: Jim Gregory <Jim.Gregory_at_daytonoh.attgis.com>
Date: 1995/04/17
Message-ID: <D76z5y.CAp_at_corsair.daytonoh.attgis.com>#1/1


>=========Jim Kennedy, 4/12/95==========
>Let us say I have a table called person with lastname,firstname,middlename.
 I
>want a list of everyone but sorted by lastname,firstname,middlename.
 

>thus:
>select * from person order by lastname,firstname,middlename;
 

>Assume I have created an index on lastname,firstname,middlename.
 

>I am using Oracle 7.1.3.3 and It keeps doing a full table scan
>and then sorting the results. Not good. I have added where rownum<1000 and
 

>that certainly is much faster, but I want the possibility of fetching the
>whole result set. I have tried hints by specifying the index to use and I
>have tried setting things up so I get best response time on first rows.
>Nothing made it any better. Any suggestions besides don't do that.
 

>Jim Kennedy

++
Instead of the order by clause try using where lastname > "" and middlename > ""

   and firstname > ""

That should force use of the index to return in the correct order without doing a sort.

Jim Gregory Received on Mon Apr 17 1995 - 00:00:00 CEST

Original text of this message