|Subject||Re: [firebird-support] Recordcount|
|Author||Werner F. Bruhin|
On 17/05/2010 16:11, Nico Callewaert wrote:
> To avoid SELECT COUNT(*) FROM....., I made a table that keeps track of the recordcount of big tables.
> TBL_RECORDCOUNT (
> RCC_TABLE VARCHAR(31) NN PK,
> RCC_COUNT INTEGER NN)
> Then I use After Insert / After Delete triggers to do a Count + 1 or Count - 1.
> Now I'm wondering : What if 2 users insert a customer record exactly the same time (I know this might not be the case), but it's just a "what if" scenario. The After Insert trigger of the Customer table will be fired and 2 simultanous updates will happen on TBL_RECORDCOUNT. I'm wondering what will happen ? A deadlock ? And perhaps the Field RCC_COUNT will no longer hold the correct value ?
What are you going to use this record count for?
Here a few links which might be helpful.
[Non-text portions of this message have been removed]