Subject | Simple SQL question |
---|---|
Author | bartsmissaert@blueyonder.co.uk |
Post date | 2008-10-22T08:45:49Z |
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
RBS
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
RBS