Why another article on this, Marco?
MySQL deadlocks is a topic covered many times, including here at Percona. I suggest you review the reference section at the end of this post for articles on how to identify deadlocks and from where they are generated.
So why another article?
The answer is that messages we receive like the following are still very common:
User (John): “Marco, our MySQL is having problems”
Marco: “Ok John what problems? Can you be a bit more
specific?”
John: “Our log scraper is collecting that MySQL has a lot of
errors”
Marco: “Ok can you share the MySQL log so I can review it?”
John: “Errors are in the application log, will share one
application log”
Marco reviews the log and in it he finds:
“ERROR 1213 (40001): Deadlock found when trying to get lock; try restarting transaction”
Marco’s reaction is: “Oh …
[Read more]