Subject Re: [firebird-support] Simple SQL question
Author bartsmissaert@blueyonder.co.uk
Ah yes, thanks, I remember that now.

RBS


>> FB 1.5 Classic on Windows.
>> Just wondering about the difference in speed in these 2 simple queries:
>>
>> select max(field1) from table1
>>
>> select max(field1) from table1 where field1 > 1000000
>>
>> The second one being a lot faster.
>>
>> The point is that this field has a unique ascending index, so if I do
>> the
>> simple phonebook analogy why is it faster to look at the last entry in
>> the
>> book or the last entry, but saying the name has to be > zaaa
>
> To speed up MAX, you need a DESCENDING index.
>
>
> --
> Best Regards,
> Thomas Steinmaurer
> LogManager Series - Logging/Auditing Suites supporting
> InterBase, Firebird, Advantage Database, MS SQL Server and
> NexusDB V2
> Upscene Productions
> http://www.upscene.com
> My blog:
> http://blog.upscene.com/thomas/
>