Wednesday, May 6, 2015

Design question/ideas for .Net Client Server application with deadlocking issue

Yep.  With a table design that complicated, you may need to use exclusive table locking for all transactions that modify the table.  EG add TABLOCKX to the DELETE.

The prime directive for eliminating deadlocks is for each transaction to acquire all the locks it needs to succeed at the very beginning.   Fiddling with the _order_ of lock acquisition is often mentioned, but is complicated and often ineffective.  Preventing your transactions from waiting for locks, while owning locks is simpler and more reliable. 

This often means taking earlier, more exclusive and less granular locks, so your transactions can wait instead of deadlock.

David


David http://ift.tt/1c5QNcs


No comments:

Post a Comment