Re: SQL Performance question

From: Luis Cabral <cabral_at_merconet.com.br>
Date: Fri, 06 Nov 1998 18:39:28 -0200
Message-ID: <36435E80.1A84B438_at_merconet.com.br>


Hi

I am not an DBA, but I think that in the 2 first queries the optimizer could use the index, but in the third it was of no help, so a temporary table was necessary to sort the result set, even because 80k rows are a lot of rows. Try creating an descending index on that column, to see what happens...

Good Luck
Luis Cabral

rakesh wrote:
>
> A table is defined as ;
>
> Table A (
> Col1 NUMBER(10),
> Col2 NUMBER(10),
> ....
> Col10 NUMBER(10),
> TimeStamp Date
> )
>
> A index was created using the TimeStamp column.
>
> Note: query results in approx. 80000 rows.
>
> The query " select * from a where timestamp between <date1> and <date2> "
> is fast.
>
> The query " select * from a where timestamp between <date1> and <date2>
> order by timestamp" is also fast.
>
> But...............the query " select * from a where timestamp between
> <date1> and <date2> order by timestamp desc" is very slow.
>
> Why should that be happening, all one has done is reverse the sort order in
> the last query !!
Received on Fri Nov 06 1998 - 21:39:28 CET

Original text of this message