Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Index usage in order by clause
Just re-read the question, and realised my reply was totally irrelevant - effectively answering the exact opposite to the question you were asking.
The index should work (for precisely the reason given in my explanation) provided the lastupdatedate were declared to be NOT NULL.
Regards
Jonathan Lewis
http://www.jlcomp.demon.co.uk/faq/ind_faq.html The Co-operative Oracle Users' FAQ
http://www.jlcomp.demon.co.uk/seminar.html Optimising Oracle Seminar - schedule updated May 1st
: Dear All,
:
: I have a question about index column in order by clause. The below query
is taking 3 min to get the result but the sametime if I comment out ORDER BY
clause it is taking only 3 secs.
:
: Is it possible to improve the performance by creating an index on
table2.lastupdatedate column
:
: SELECT * FROM (
: SELECT /*+ FIRST_ROWS */
: p.processed_by,
: p.last_name,
: p.first_name,
: p.company_name,
: p.userid
: FROM table1 p,table2 e
: where p.business_country_id='GB'
: and p.uk=e.pk
: and e.userstatusid in ('5')
: order by e.lastupdatedate desc
: )
: WHERE ROWNUM <=10
: /
:
-- Archives are at http://www.freelists.org/archives/oracle-l/ FAQ is at http://www.freelists.org/help/fom-serve/cache/1.html -----------------------------------------------------------------Received on Tue Jun 15 2004 - 08:17:14 CDT