Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Performance ploblems using "order by"

Performance ploblems using "order by"

From: test <test_at_test.nl>
Date: Mon, 15 Feb 1999 15:12:41 +0100
Message-ID: <01be58ed$1b0728a0$6a7910ac@mgt3y>


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

Original text of this message

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