Subject Re: [firebird-support] Adding second sort column slows down sorting 100-fold
Author Alec Swan
Hello,

The "SELECT FIRST 1000 *" is interesting. Do you know how
> many rows the query would select without the "FIRST" clause?
>

40,000 records would have been returned without "FIRST" clause.


> If it's a lot more than 1000, then the problem is that
> Firebird can't walk two indexes at once, so ordering by two
> fields with separate indexes requires that it retrieve all
> the qualifying rows, sort them, then throw out all the rows
> it selected after the first 1000.
>

This seems like a pretty common problem people would run into when
implementing paginated query results. So, what is your recommendation here?

Thanks,

Alec


[Non-text portions of this message have been removed]