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: Can I define an index for a select statement.

Re: Can I define an index for a select statement.

From: Kenny Gump <kgump_at_mylanlabs.com>
Date: Fri, 5 Mar 1999 16:20:08 -0500
Message-ID: <36e04a19.0@news.mountain.net>


You can give the optimizer a hint that may help:

select /*+INDEX (T1 myindex2name) */ * from Invoice T1
order by InvoiceDate;

But in your case it will not use the index because it is sorted 1st by InvoiceNo then by InvoiceDate. You may want to create another index just on InvoiceDate if you are wanting to use it in this way.

Kenny Gump
OCP 7.3 DBA



John Francis Lundy wrote in message <36e01880.0_at_news.proweb.co.uk>...
>Primary key - InvoiceNo
>Secondary key - InvoiceNo,InvoiceDate
>
>20,000 records
>
>select * from Invoice - 3 seconds
>
>select * from Invoice - 22 seconds
>order by InvoiceDate
>
>if the second query used the secondary index it should be faster as they'd
>be ordered already.
>Can I select the index? Whats my problem please help.
>
>
Received on Fri Mar 05 1999 - 15:20:08 CST

Original text of this message

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