- Newest
- Most votes
- Most comments
Hi,
A deadlock is usually not something that you can fix at database manager level. It requires to change(s) to application.
This article explains very well what they are: https://www.site24x7.com/learn/resolve-sql-server-deadlocks.html
To fix them, you usually need to ensure that application access SAME resources in SAME order when updating them. If not, you risk having process A owning a write lock on table Tx and willing one on Ty while process B has a write lock on Ty and wants one on Tx. It's the perfect deadlock.
If both A & B access Tx first and then Ty, then you avoid deadlocks. This basic example gives a good idea on how deadlocks occur.
If you cannot guarantee order of access, you will need to handle automatic retry in the application code to retry when the dbms kills on of the transactions to keep going. See the article for that.
Best.
Didier
Relevant content
asked 5 years ago
- AWS OFFICIALUpdated 2 years ago

What about this error SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction ? Which Parameter needs to be set?