"(Bill Karwin is writing from this link https://www.quora.com/How-do-I-to-avoid-deadlock-in-a-database#)
There are basically three methods to avoid deadlocks:
Serial access. This is obviously not practical, but if you ensure that only one transaction at a time can access the database, there can be no chance of deadlock.
Atomic/pessimistic locking. Make sure any lock request locks all the resources needed during a transaction, or none at all. Most databases use optimistic locking, which involves gaps between requests for different resources. That creates an opportunity for another transaction to interleave their requests with yours and therefore possible deadlock.
Autocommit. A variation on the Atomic Locking strategy includes the practice of using autocommit transactions, so that each transaction can only lock one resource immediately as it uses it, then finishes its transaction and releases its lock before requesting any other resource. However, this doesn't quite work in some database implementations that can perform non-atomic locking against multiple indexes even for a single-statement transaction (cf. MySQL and UNIQUE KEY insert intention locks).
Ordered updates. If transactions always request resources in the same order (e.g. numerically ascending by the index value of the row being locked) then they won't deadlock. A detailed explanation of why this works can be found here: LCK07-J. Avoid deadlock by requesting and releasing locks in the same order"
you could try contacting Monica Agu (she has a research gate account as well) to ask for help as she is highly skilled in deadlock avoidance in systems