N/APosted on - 10/31/2013
I am getting the following error message when I try to do a batch insert of about 700 floats. I just get this annoying problem when try to restart the transaction. How can I fix this issue? Have any idea to resolve the following matter? I would be grateful to you. Thanks in advance.
Deadlock found when trying to get lock; try restarting transaction
Deadlock found when trying to get a lock
This situation occurs when two transaction hold on each other to again lock. So, concurrent transactions never try to update a row which creates deadlock.
T1: lock x, then y
T 2: lock y, then x
To avoid the deadlock, change the queries such that transactions would lock at same order.
T 1: locks key x, locks key y;
T 2: locks key x, locks key y;
There can also be problem of missing indexes. Always make sure to have indexes on foreign or primary keys. If not done this way, this could result in table lock instead of row lock.