Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: how to fetch the first n rows only for a query
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