Re: How can I limit the NUMBER of rows returned?

From: DavidJRoth <davidjroth_at_aol.com>
Date: 31 Jan 1995 04:28:44 -0500
Message-ID: <3gkvsc$srk_at_newsbf02.news.aol.com>


#Subject: Re: How can I limit the NUMBER of rows returned?
#From: stowe <stowe_at_aol.com>
#Date: 30 Jan 1995 17:58:54 GMT
#Message-ID: <3gj9d0$2ue_at_News1.mcs.com>

#> Doing selects from Solaris middleware with ProC to an Oracle7 server.
#> Returned tables are normally small & quick, but occasionally we get a
query
#> which returns way too many rows so that even the first fetch is greatly
#delayed.
#> I'd be happy to take the first 100 rows quickly, and ignore the rest.
#> Any suggestions?

#select * from ...
#where ROWNUM < 100;

Note: ROWNUM will return the first n rows fetched. Sorting is done after the fetch.

There is a cost based optimizer hint that is supposed to speed up return of the first row. I have not tried it. If it works please post your results.

David Roth

Carty Mailloux Consulting                        All opinions expressed
UNIX Client/Server System Integrators      are my own.
(508) 392-1300x20 Received on Tue Jan 31 1995 - 10:28:44 CET

Original text of this message