Subject | Re: [firebird-support] Why the difference? |
---|---|
Author | W O |
Post date | 2013-03-01T13:00:12Z |
Hello Mark
Thank you for your answer.
So, the clause ORDER BY should be used just when the table has few rows?
Because if do not use the indexes does not make sense to use it with big
tables.
Greetings.
Walter.
Thank you for your answer.
So, the clause ORDER BY should be used just when the table has few rows?
Because if do not use the indexes does not make sense to use it with big
tables.
Greetings.
Walter.
On Fri, Mar 1, 2013 at 8:41 AM, Mark Rotteveel <mark@...> wrote:
> **
>
>
> 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
>
>
>
[Non-text portions of this message have been removed]