Subject Re: Limiting fetched rows doesn't offer much performance benefit
Author jimbehr3446
--- In firebird-support@yahoogroups.com, Richard Wesley <hawkfish@...>
wrote:
>
> Especially if one is trying to do sampling of the table. Consider
> the query
>
> select * from table where rand() < .01;
>
> to sample a table. Ideally, this would just create a stream of rows
> and throw out 90% of them. Does FB actually have to instantiate the
> (potentially humongous) table here too?
>
I'm not sure that query would work since you haven't specified a
fieldname in the where clause. But, ignoring that, I believe FB will
look at every record (using an index of course if available) to
determine the complete list and then it will return the number you
specify in the FIRST n clause.

Thanks for your comments.