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 -> How to optimize queries with ORDER BY field DESC

How to optimize queries with ORDER BY field DESC

From: <frleong_at_bigfoot.com>
Date: Mon, 14 Sep 1998 04:15:47 GMT
Message-ID: <6ti59i$rm2$1@nnrp1.dejanews.com>


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

Original text of this message

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