Subject RE: [firebird-support] What programming languages and toolkits do you use to access Firebird?
Author Alan McDonald
> This SELECT Count(*) problem is really incredible. I can understand
> concurent
> transactions see different versions of the same table. Why is it
> difficult for every
> of these versions to also have their own row count ?
>
> Thank you,
> Timothy Madden
>

if you want tables to have a count (as opposed to result sets e.g. joins)
then it's quite trivial to do this yourself via triggers and a small
maintenance routine.
keep a table with tablename and reccount fields, on delete, insert a -1 into
this table for the table name, on insert, insert a +1 into this table.
Maintenance is just a removal of all records from the table and insert a
single select count(*) result.
Then when you want the count just sum reccount from the table for the table
name. If you do the maintenance routine regularly, you will get very fast
count results.
If the engine were to do this for you, it would probably do something very
similar to this anyway.
Alan