Re: TOP TEN LISTS? HELP.

From: Youichi Tamura <y-tamura_at_nriws11.nri.co.jp>
Date: Tue, 20 Dec 1994 08:09:34 GMT
Message-ID: <D13nzy.H5M_at_nrigw11.nri.co.jp>


In article <1994Dec16.130358.39280_at_earlham.edu> edwardd_at_tian.earlham.edu writes:
>>>
>>Following is supposed to work. Try this
>>
>>SELECT FLD
>>FROM TAB1 A
>>WHERE rownum <= 10; (here N = 10)
>
>This works, but oracle does not stop scanning when it gets the 10
>records you want. If the table is big, it will continue to scan
>every row, checking rownum for each. However, I don't know any
>other way to get it done in SQL efficiently.
>

This does not get you the "TOP TEN," only the first 10 rows fetched. Also, I thought ORACLE stops fetching rows from a table after the first 10 rows are fetched, i.e. it does not scan every row checking rownum for each. At least that's what my experience indicates. Issue a SELECT statement like the above against a huge table (with a million rows) and you get a response immediately.

-- 
							Yoichi Tamura
							y-tamura_at_nri.co.jp
Received on Tue Dec 20 1994 - 09:09:34 CET

Original text of this message