Subject Re: [firebird-support] no-wait vs wait transactions?
Author Ann Harrison


On Jul 8, 2014, at 3:37 PM, "jonatan.lauritsen@... [firebird-support]" <firebird-support@yahoogroups.com> wrote:

I have Firebird 2.x database which from time to time has rather long transactions - up to 30 seconds and so, there is high probability that the same record will be updated from the several different transactions and the lock conflict - deadlock exeption will be raised. I am currently using nowait transactions.

The question is - what is the best option in this case - to use wait or nowait transactions? 

Generally I prefer wait transactions to no-wait to avoid "live lock"  - the problem that occurs when Transaction A has a resource that Transaction B needs.  B tries, fails, retries, fails again and so on until A finally releases the resource.  When B is a wait transaction, it sits quietly until A releases the resource, then either succeeds (if A failed) or gets and error if A succeeded.  The wait case avoids a lot of pointless cycles.  

I have no idea how BDE transactions behave ... Borland had some very imaginative engineers.  

There should be no problem mixing wait and no wait transactions - some will use more resources, some will return errors to the user (or whatever is on the other end) sooner.  

Good luck,

Ann

Not to make you jealous or anything, but we just came back into cell phone range on our leisurely cruise down the Maine coast.  I'd send a picture, but the list won't let me.  Now it's 6:30.  The drinks flag is out; the dog has had her run through the woods and a bit of swimming.  Life is good.