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

Home -> Community -> Usenet -> c.d.o.server -> Re: how to fetch the first n rows only for a query

Re: how to fetch the first n rows only for a query

From: Jaap W. van Dijk <j.w.vandijk.removethis_at_hetnet.nl>
Date: Fri, 26 Jul 2002 21:33:23 GMT
Message-ID: <3d41beb3.1673194@news.jaapwvandijk.myweb.nl>


On Fri, 26 Jul 2002 11:39:14 +1000, "Richard Foote" <richard.foote_at_bigpond.com> wrote:

...
>3) And this is the nice bit. Oracle *knows* when it performs the inline view
>I only want 10 rows (by checking the outer query predicate). Therefore as it
>ploughs through the data in the inline view, it actually only keeps track of
>the 10 rows that have the lowest values.

I didn't know that Oracle was that intelligent! A question remains though: how will Oracle plough through the data if there is an index on the relevant columns? Will it do a FTS or (like I suggest in my hint) will it descent the index until it has reached the required number, which is especially beneficial when the required number is low in a big table?

Jaap. Received on Fri Jul 26 2002 - 16:33:23 CDT

Original text of this message

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