Subject Re: is this a good index
Author Svein Erling Tysvær
--- In firebird-support@yahoogroups.com, "jameschua1021" wrote:
> Hi Set,
>
> <svein.erling.tysvaer@k...> wrote:
> > Max Dup: 80 sounds OK to me, but it all depends on how you use
> > your database. It is lousy if it contains historical data and you
> > frequently do WHERE MyField < 'Yesterday'.
> >
> > Set
>
> Can you explain why do you find it lousy if i where to do "WHERE
> MyField < 'Yesterday'"
>
> Apinot

Hi Apinot!

Simply because the quickest way to access rows is to do it in natural
order. Indexes are useful when most rows can be eliminated because
they do not match the criterium, but if almost all records are to be
returned, then NATURAL will be quicker than using the index. Likewise,
if an almost unique index is used for a table within the plan, then
additional use of other indexes on that table may slow down the
execution of the query (the optimizer in Firebird 1.5 is smarter than
the one in Firebird 1.0). A typical example would be if you already
used an index on NAME, then using an additional index for COUNTRY
ought to be avoided in most cases.

Set