Subject Re: LIMIT record in SELECT query gets slow
Author Svein Erling Tysvær
Hi Jasper,
don't forget that at the heart of Firebird is the multi-generational
architecture. I.e. there can be multiple versions of every record, and
if my understanding is correct (it is a big if), the only way to see
if a particular version of a record is valid for your transaction is
to look at the record (it could also be that no version of the record
is available for your transaction, due to inserts or deletes).

If Firebird had been a desktop database, your thinking would have been
the natural way to skip records, but a database as client/server
oriented as Firebird probably cannot do that.

I hope I'm wrong,
Set

--- In firebird-support@yahoogroups.com, "jasperelzinga" wrote:
> Thanks for your reaction.
>
> I have been thinking about it, and i think firebird shouldn't have
> to run the entire query if I make a index on the same field as where
> i'm ordering by. Using the index, firebird should be able to pick
> the [skipped] number without having to run any query, and then
> select the amount of records i want.
>
> I have tried this and it doesn't work. But maybe it's possible with
> a PLAN clause? I can't find much documentation about using PLAN. Do
> you/anyone know more about this?
>
> Jasper