Subject | slow select max() query |
---|---|
Author | Kirill Nesterenko |
Post date | 2009-03-09T18:22:33Z |
Firebird 2.1.1
Query: select max(ID) from TABLE where FIELD=4
Runs quite slowly. Apparently it scans whole index.
When changed to "min" - it runs immediately.
I have both indices:
create index IDX1 on TABLE(FIELD)
create descending index IDX2 on TABLE(FIELD)
Am I missing something fundamental here? I always thought descending index
should do the thing...
Kirill.
Query: select max(ID) from TABLE where FIELD=4
Runs quite slowly. Apparently it scans whole index.
When changed to "min" - it runs immediately.
I have both indices:
create index IDX1 on TABLE(FIELD)
create descending index IDX2 on TABLE(FIELD)
Am I missing something fundamental here? I always thought descending index
should do the thing...
Kirill.