Subject Re: [firebird-support] Re: Limiting fetched rows doesn't offer much performance benefit
Author Ivan Prenosil
>> My guess is, that Firebird will "materialize" the resultset for
>> FROM TABLE WHERE FLAG='Y'
>> before applying the FIRST 50 to it.
>>
> That is certainly what we are observing. It's too bad it is not smart
> enought to realize there are no ordering clauses and quit when it has
> the desired number of records.

Firebird will first use the index to create list of potentially matching records,
then it retrieves first 50 and stops, it will not read all rows internally.
The rows will be retrieved in the most convenient order to minimize
disk head moving, i.e. by dbkey.

Ivan
http://www.volny.cz/iprenosil/interbase/