Subject | Recordcount |
---|---|
Author | Nico Callewaert |
Post date | 2010-05-17T14:11:06Z |
Hi,
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 ?
Many thanks in advance !
Nico
[Non-text portions of this message have been removed]
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 ?
Many thanks in advance !
Nico
[Non-text portions of this message have been removed]