Subject Re: [firebird-support] Count(*) on big tables
Author Nando Dessena
Elmar,

E> Beware of transactions here. Concurrent Inserts/Deletes might block on
E> updating the counter!

yep, maintaining a running counter through updates is a serious
bottleneck and should be avoided. The key here is to *insert* records
(as opposed to updating a single record) into a counting table (insert
1 for inserts, -1 for deletes) and sum() it to get the total count.
From time to time a procedure that aggregates the count should be run
to keep the number of record of the counting table acceptably low.

Ciao
--
Nando Dessena
mailto:nandod@...