Subject | Re: [firebird-support] Count(*) on big tables |
---|---|
Author | Jonathan Neve |
Post date | 2004-05-06T08:09:50Z |
Nando Dessena wrote:
Firebird in a transparent way. I mean, finding out the number of records
in a table doesn't seem to me to be such a luxery... :-) A solution like
this would certainly make every day life much easier.
Jonathan Neve.
>Elmar,This is such a good idea, that one wonders why it isn't integrated into
>
>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
>
>
Firebird in a transparent way. I mean, finding out the number of records
in a table doesn't seem to me to be such a luxery... :-) A solution like
this would certainly make every day life much easier.
Jonathan Neve.