Home » SQL & PL/SQL » SQL & PL/SQL » Question on order by clause
Question on order by clause [message #21480] Wed, 07 August 2002 01:49 Go to next message
Giridhar
Messages: 38
Registered: May 2001
Member
Hi,

I have a query which group by the column in the index.

for example
If i have dept table which has deptno as PK.
in my query i have a group by clause for the deptno,
Even though i am using the GROUP BY Function It need not sort the data
As it is already sorted in the index.

If i order the same query in the descending order,
then optimiser is sorting the data.
So We thought that using the INDEX_DESC hint would skip
the sorting the data as that column is already in the index and
it is sorted.
Inspite of using the INDEX_DESC hint,optimiser is sorting the
data which we want to avoid.

Can any one suggest a way where we can avoid a SORT
while ordering the data in the descending order?

Regards,
Giridhar Kodakalla
Re: Question on order by clause [message #21506 is a reply to message #21480] Thu, 08 August 2002 12:00 Go to previous message
Yogesh
Messages: 42
Registered: December 2001
Member
Hi,
I am not sure if this going to be useful.
Its not necessary that oracle will use existing indexes while executing the query. Oracle will ignore the index if you are using any function e.g(substr, nvl.. etc) on any column in the index.
Previous Topic: Simple SQL query
Next Topic: Select Question
Goto Forum:
  


Current Time: Thu Apr 25 14:28:32 CDT 2024