Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Strange Oracle Optimization
Kin Ng wrote:
> Actually the query returns LOTs of rows. It just took a long time
> (and err out) for a Large set of rows. I started trying to do ROWNUM
> = 1 and it returned FAST. Then I tried ROWNUM < 1000 and it returned
> a thousand rows fast. Then I tried ROWNUM < 10,000, then 1 million
> and finally ROWNUM > 0 and ALL cases it returned lots of rows and
> FAST.
>
> > > Why adding this makes a query run so much faster?
To answer your question requires running EXPLAIN PLAN on both versions ... with and without the added clause.
BTW: Something you should be doing with every SQL statement you write.
-- Daniel Morgan http://www.outreach.washington.edu/extinfo/certprog/oad/oad_crs.asp damorgan_at_x.washington.edu (replace 'x' with a 'u' to reply)Received on Sun Jul 13 2003 - 18:04:04 CDT