Execute “Show Engine InnoDB Status;” query analyze the result in “Transaction” section, find out problematic queries.
Now next step is to how to avoid this problem, and here is a solution:
Deadlocks are a classic problem in transactional databases, but they are not dangerous unless they are so frequent that you cannot run certain transactions at all. Normally, you must write your applications so that they are always prepared to re-issue a transaction if it gets rolled back because of a deadlock.
- Always be prepared to re-issue a transaction if it fails due to deadlock. Deadlocks are not dangerous. Just try again.
- Keep transactions small and short in duration to make them less prone to collision.
Reference : …
[Read more]