Quote:
Originally posted by ARWinner
First, just a refresher of an example of what constitues a deadlock:
ProcessA wants resource1, locks it
ProcessB wants resource2, locks it
ProcessA wants resource2, waits for lock to finish
ProcessB wants resource1, waits for lock --> deadlock
Suggestions:
1) have your processes access (insert,update, delete) tables in the same order. e.g. Always access TableA, then TableB.
2) have shorter Units of Work (UOW) when possible. This prevents locks being held that are no longer needed.
3) specify a small lock wait timeout. Better to timeout on obtaining a lock, then deadlocking.
HTH
Andy
|
Thank you ARWinner, I should say
1- all three processes are trying to insert rows in ONE table, so you think even "small lock wait timeout" works?
2- I suggested to developers to create three temptables for inserting rows in them and then import from those temptable to original table. Is it work (from performance point of view) ?
thanks