Subject Re: [firebird-support] Fwd: How to avoid deadlock ?
Author Ann Harrison
On Thu, Jan 12, 2012 at 11:22 AM, Vander Clock Stephane
<svanderclock@...> wrote:

> everytime one user add or delete one row in
> Table_Data, then trigger will update the
> table_stats (NB_IDs) by increasing or decreasing
> the actual number in it
> several user can update different row at the same in
> table_data
> how to avoid deadlock when the trigger update the NB_Ds
> in table_stats ? what mechanisme to use  ?

The usual answer (which is in the FAQ) is to have the change to
Table_Data insert a row into table_stats indicating that it added a
value (+1) or removed one (-1). Periodically, run a procedure to
aggregate the results.
Updates will cause deadlocks unless they are serialized, meaning that
only one transaction can change Table_Data at a time.

Good luck,