|Subject||Re: need help on optimization|
> >And a query like:read
> > select distinct "id" from mytable
> > 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.Does this also include the usage of MAX ?
> >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 ?
I.e. If I want to have
And there is an index defined using date.
Will it still not use the index ?
And why not ?