Subject Re: need help on optimization
Author Michael Vilhelmsen
> >And a query like:
> > select distinct "id" from mytable
> >or:
> > select "id" from mytable group by "id"
> >also takes around five minutes, even though it says it is using
> >the index created on "id".
> The first query can't use an index. In the second, to determine
> "distinctness", without any limiting WHERE clause, it's necessary to
> the whole table.
> >It appears that firebird is
> >searching over every row in the table, and isn't just using
> >the information in the index to construct the result.
> In the first two cases, it does have to read every row. How would you
> suppose an index could be used ?

Does this also include the usage of MAX ?

I.e. If I want to have

from MyTable

And there is an index defined using date.

Will it still not use the index ?
And why not ?