Subject Re: [firebird-support] How to index?
Author Ann W. Harrison
At 09:21 AM 11/9/2004, Ales Smodis wrote:

>Wouldn't it be faster using the index to group together records and
>do the sum, instead of sorting it and doing the sum? I mean, if
>the data is already properly indexed (sorted), why do sorting
>anyway? It should be faster, but then again I don't know the
>internals.

The answer is that indexed and sorted are two different things
in Firebird.

Some systems store data in indexes. The lowest level of the
primary key index contains the actual records. Typically in a
system like that, secondary indexes contain the indexed value
and the primary key of the record. Primary key lookups are fast,
but secondary key lookups are slow.

Firebird stores indexes and records separately. Data pages
contain data, index pages contain index nodes. The lowest level
of the index contains the address of the record. The fastest
way to read all the records in a table is to read all the data
pages.

Regards,


Ann