Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Can I use an index to get the last n records?
If I have a table with 100,000,000 rows
sales(sales_id, sales_person_id, sales_date_time, ...)
create index sales_date_index on sales (sales_person_id, sales_date_time);
I want to execute something like this (which doesnt work at all)
select * from sales
where sales_person_id = :sales_person_param
and rownum < 10
order by sales_date_time desc
I want it to use my sales_date_index to read just 10 indexed records - NOT read all records for the sales_person_id, sort in memory and then return me the result set.
Anyway in general I can force traversal of the records using an index?
thanks Received on Mon Jul 16 2007 - 10:00:34 CDT