Subject Re: [firebird-support] select fieldA >= xxx is very very slow on Big table ?
Author Paul Vinkenoog
All,

>> why this simple sentence :
>>
>> Select
>>   First 1 skip 0 ID
>> from
>>   TABLEA
>> where
>>   FIELDA >= xxx
>> PLAN (TABLEA INDEX (FIELDA_IDX))
>>
>> is very slow on big table (> 20 000 000 rows) ... it's take more
>> than 10
>> seconds to return :(
>>
>> this is an index on FIELDA
>>
>> did i do something wrong ?
>
> How many records would be returned without the FIRST...SKIP clause?
> I think Firebird has to get all those records first and then will
> return only the first to you.

Hmmm, I'd say it doesn't have to get all the matching records. Just the
first one where fielda >= xxx. It doesn't even have to get the *smallest*
matching fielda (although it probably will), because there's no ORDER BY.


Paul Vinkenoog