Subject Re: [firebird-support] Why the difference?
Author Mark Rotteveel
On Fri, 1 Mar 2013 08:32:09 -0400, W O <sistemas2000profesional@...>
wrote:
> But the strange thing is that PER_IDENTI is the Primary Key and ORDER BY
> seems not use it.

As Firebird is retrieving all rows anyway, there is - AFAIK - no benefit
to use the primary key index for the ORDER BY. Unlike some other databases,
Firebird does not have clustered indexes so rows are not stored in their
(primary key) index order, and retrieving rows in index order is probably a
lot more inefficient then loading them in storage order and then sorting
(although that is debatable given your dataset size).

Given the size of (3.5 * 10^6) rows versus the use of ROWS 1 TO 100
retrieving those first 100 in index order would probably have been more
efficient in this particular case, but Firebird doesn't seem to do that
(yet?).

Mark