![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have a small database that I have been testing. I get an error about a transaction deadlock. The code is in stored procedures and I added transactions to the sp's but the error happened again. I wrapped the whole sp in just one transaction and I don't have any index on the tables. When I test just by running a program that sends 3 calls at a time it will get a deadlocked transaction as I send 6 or 9 at a time. I am not sure how it can have a deadlocked transaction after I used transactions(begin and commit) in the sp's. Steve |
#3
| |||
| |||
|
|
I have a small database that I have been testing. I get an error about a transactiondeadlock. The code is in stored procedures and I added transactions to the sp's but the error happened again. I wrapped the whole sp in just one transaction and I don't have any index on the tables. When I test just by running a program that sends 3 calls at a time it will get a deadlocked transaction as I send 6 or 9 at a time. I am not sure how it can have a deadlocked transaction after I used transactions(begin and commit) in the sp's. Steve |
#4
| |||
| |||
|
|
I have a small database that I have been testing. I get an error about a transaction deadlock. The code is in stored procedures and I added transactions to the sp's but the error happened again. I wrapped the whole sp in just one transaction and I don't have any index on the tables. When I test just by running a program that sends 3 calls at a time it will get a deadlocked transaction as I send 6 or 9 at a time. I am not sure how it can have a deadlocked transaction after I used transactions(begin and commit) in the sp's. Steve |
#5
| |||
| |||
|
|
A transaction holds locks on objects until all operations within the transaction are committed. If you wrap your entire SP within a transaction, that means all objects accessed by the SP are blocked until the SP completes. So, contrary to what you expected, doing so increases the chances of deadlocks. |
|
Try to limit the operations you enclose in a transaction. If you can avoid it or if it's not necessary, don't use transactions at all. |
![]() |
| Thread Tools | |
| Display Modes | |
| |