Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Using Indexes
In this case there is no limiting condition given. If you want to force it to
use the index try
SELECT IDCODE FROM PERSONEL
WHERE IDCODE > <some very low value>
ORDER BY IDCODE;
Since it's already sorted it will only use the index. There's no need for the
sort step. But for the same query if you are giving an
ORDER BY IDCODE DESC then it use the index and also do the sorting.
Denny
In article <36DAC9AF.6A9E74C9_at_yahoo.com>,
DelphiDev <DelphiDev_at_yahoo.com> wrote:
> I have submitted the following statements to SQL Plus 3.3 on Oracle 7.0:
>
> SELECT IDCODE FROM PERSONEL ORDER BY IDCODE;
>
> This query takes a fair amount of time. I then index it and run the
> query again:
>
> CREATE INDEX IDCODEINDEX ON PERSONEL(IDCODE)
> SELECT IDCODE FROM PERSONEL ORDER BY IDCODE;
>
> The query seems to take the same amount of time to "Order" the records
> before actually printing them. I assume that if a index is present then
> Oracle will take advantage of it. This doesn't seem to be the case.
> Could someone explain this?
>
> Thanks, Stan.
>
>
-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Mon Mar 01 1999 - 14:37:20 CST
![]() |
![]() |