Subject | Re: [firebird-support] Simple SQL question |
---|---|
Author | Thomas Steinmaurer |
Post date | 2008-10-22T08:47:32Z |
> FB 1.5 Classic on Windows.To speed up MAX, you need a DESCENDING index.
> 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
--
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/