Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

FIRST_ROWS(2) and ROWNUM in WHERE clause.

guruparanJun 5 2008 — edited Jun 5 2008

Hi

I am little bit curious when I wrote this post.

 SELECT *
   FROM emp
 WHERE ROWNUM < 2;

against

 SELECT /*+ FIRST_ROWS(1)*/ *
   FROM emp;

When I saw 'EXPLAIN_PLAN' there was huge difference and the second query was a lot better. I know that with the second query we are passing a hint to Optimizer.

But, let some one explain it more clearly?

Thanks in advance.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 3 2008
Added on Jun 5 2008
9 comments
1,693 views