Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Performance ploblems using "order by"
Hi,
I have got a problem with the performance of a query when I use a "order by" clause in it. The table contains over the 100,000 records. For example:
select * from employees order by name desc, age asc;
When I use a index to sort the result of the query I only can choose to do this ascending or descending by using a optimizer hint. For example:
select --+ index_desc(employees idx_name_age)
from employees
where age > 0; /* forces the optimizer to use index idx_name_age */
The index is created as:
create index idx_name_age on employees(name, age);
Can anyone tell me how I can sort my result by using an index on multiple columns? I want the column 'name' to be sorted as first descending and the column 'age' ascending as second.
Thanks,
Gert-Jan
email:Gert-JanKerpershoek_at_nl.origin-it.com
Received on Mon Feb 15 1999 - 08:12:41 CST
![]() |
![]() |