Subject Re: [ib-support] But min and max are slow even with indexes
Author Helen Borrie
At 02:56 PM 09-08-02 +1000, you wrote:
>This query was less impressive:
> min(start_time),
> max(start_time)
>from sawmembersarchived
>The first run was 41 seconds, then it came down to about 4 seconds. That's
>instantaneous like the condition. Is there a way to speed this up? Or do the
>indexes simply not address this sort of thing?
>I would have thought that if they helped with the > and < operators,
>getting the
>min and max would have been easy. Cananyone enlighten me?

A descending index will speed a Max(); an ascending index will speed a Min().

If you are using Firebird, index appropriately and consider (compare) also

select first 1 start_time from aTable
order by start_time (for equivalent of MIN())


order by start_time desc (for equivalent of MAX())


All for Open and Open for All
Firebird Open SQL Database · ·