Subject Re[2]: [ib-support] Strange query problem
Author Daniel Rail
Hi,


>>
>> Yes, use order by instead of group by.
>>
>> Just selecting an indexed field doesn't convince the optimizer to use
>> the index ;-)

> Even more - WHY should it read indexed if you don't use any
> WHERE clause ... you want all rows, Firebird/IB will give it to
> you and in that case, a "natural" (unindexed) read is fastest.

If you want the result set ordered, I think it's quicker to use an
index to sort, if one exists for the column. Otherwise, Firebird/IB
will have to sort the result set using another logic, and that logic
might be slower than using an index. Definitely, if you don't want the
result set ordered, why bother trying to use an index(other than for
the WHERE clause).

Daniel Rail
Senior System Engineer
ACCRA Group Inc. (www.accra.ca)
ACCRA Med Software Inc. (www.accramed.ca)