Subject Re: [firebird-support] Is it possible to avoid update deadlocks in Firebird ?
Author David Johnson
In any DBMS, a deadlock occurs when you have two (or more) resources and you
request locks on them in different sequences.

If, within a transaction you update A then B, meanwhile you have another
simultaneous transaction updating B then A, you will deadlock becaus both
transactions are waiting on the other to release the same resource before
they ocntinue.

If, on the otherhand, you marshal your resources or use some simple rule to
guarantee that resources are always locked in the same sequence
(alphabetical for example) you will never have a deadlock.

I suggest locking resources in alphabetical order by name, because it is
easy to remember and check for.

----- Original Message -----
From: "Boguslaw Brandys" <brandys@...>
To: <firebird-support@yahoogroups.com>
Sent: Monday, May 31, 2004 1:50 PM
Subject: [firebird-support] Is it possible to avoid update deadlocks in
Firebird ?


> Hello,
>
> I have a few executable SP called one after another, which did some
> computations and among them update some goods count like in stock or
> inventory list in a simple way like this :
>
> update Goods_In_Stock set Amount = Amount + :Increment
> where Goods = :Goods
>
>
> If deadlock occur I would like to simply do commit, however becouse those
> SP are called one after another I must do a rollback always becouse
> deadlock origin is not known (if I use commit there will be partialy
> written changes from previous executable SP - is it true? )
> I'm wondering if there is a solution to avoid update deadlocks with
> Firebird with use of insert , delete , select, another table combination ?
>
> --
> Best Regards
> Bogusław Brandys
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>