Subject | Re: Not using index for MAX |
---|---|
Author | Adam |
Post date | 2007-10-28T03:06:39Z |
--- In firebird-support@yahoogroups.com, "Erick Sasse" <esasse@...> wrote:
than unidirectional indices. Having larger indices means that you have
more sparse index pages and reading the index to will take longer.
Also, don't assume the highest record in the index equals the max, the
highest record may belong to an uncommitted transaction, or your
transaction isolation properties may otherwise prevent you from
reading it.
If you want to run select max(), give Firebird a descending index on
that field.
Adam
>Bidirectional indices take up more space and so must be less dense
> Ok, but I don't get it. Can't it just get the last record in the
> index? Isn't it as easy as use a descending index?
than unidirectional indices. Having larger indices means that you have
more sparse index pages and reading the index to will take longer.
Also, don't assume the highest record in the index equals the max, the
highest record may belong to an uncommitted transaction, or your
transaction isolation properties may otherwise prevent you from
reading it.
If you want to run select max(), give Firebird a descending index on
that field.
Adam