Subject | Re: [firebird-support] Re: Not using index for MAX |
---|---|
Author | Erick Sasse |
Post date | 2007-10-28T21:02:49Z |
Thanks!
--
Erick Sasse
2007/10/28, Adam <s3057043@...>:
--
Erick Sasse
2007/10/28, Adam <s3057043@...>:
> --- In firebird-support@yahoogroups.com, "Erick Sasse" <esasse@...> wrote:
> >
> > 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?
>
> Bidirectional indices take up more space and so must be less dense
> 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
>
>
>
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Visit http://www.firebirdsql.org and click the Resources item
> on the main (top) menu. Try Knowledgebase and FAQ links !
>
> Also search the knowledgebases at http://www.ibphoenix.com
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> Yahoo! Groups Links
>
>
>
>