Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> How to optimize queries with ORDER BY field DESC
Hello!
I have got a relatively small table of around 4000 rows stored in an Oracle 7.2 database with a primary key field called ID. The users need to perform some ad-hoc queries like:
SELECT * FROM Table1
WHERE ID<Something
ORDER BY ID ASC
The above query is almost instantaneous and so no problems.
However, the queries take much longer if they are changed to
SELECT * FROM Table1
WHERE ID<Something
ORDER BY ID DESC
The descending sort seems to be the troublemaker. What can I do to speed up
both queries? Do I need to create more indexes? If this is so, how? Thanks.
Francisco Leong
---
frleong_at_bigfoot.com
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
Received on Sun Sep 13 1998 - 23:15:47 CDT