Subject Re: [ib-support] PLAN
Author Ivan Prenosil
> I've created a query that is making a SUM of some records. I've checked
> the PLAN and I noticed that it is using NATURAL sort order. I guess that
> is normal for aggregate functions ? Is it better to avoid using SUM then ?
> Performance ?

Interbase needs to visit all records that participate in aggregate function.
E.g. if you do SUM of values from all records of table, then all records must be
internally read (->plan NATURAL); it is not possible to read these values from index
(because of MGA architecture).

On large tables it can really cause a problem with performance.
Either avoid using SUM, or limit number of rows with WHERE clause,
or implement some kind of caching summed values, ...

Ivan
prenosil@...
http://www.volny.cz/iprenosil/interbase