Subject Re: How to gat a good performance
Author Adam
> But why Firebird do not use a index when there are aggregate
> functions in query ?

It does and will!

The problem is that you did not provide a descending index for it, so
a full table scan was "cheaper" than using the index that was
available. Unlike other databases, Firebird's indices are
unidirectional only. This saves on space and allows higher density,
making the indices require less pages and hence a higher speed.

> And after the second execution, it will alway takes 3,4 seconds to
> return a result.
> It seems that there no cache for the results.

Do yourself a favour and use a tool that can break down the time taken
into three categories.

1. Preparation Time: How long does it take for the optimiser to choose
the fastest plan.

2. Execution Time: How long does it take to do the work.

3. Fetch Time: How long does it take to return all those records.

You do not have to do anything to get it to cache information. It will
do it automatically, but for all we know, fetch time might be 3
seconds, the only way to speed that up is to have a faster network or
less data.