Determine Reason for Deadlock in MySQL

Posted on

Question :

We’ve been seeing some deadlocks occur but have not been able to reproduce. Is there any way to determine, after the fact, what queries were running, etc to figure out why deadlock occurred?

Answer :

SHOW INNODB STATUS will give you the last detected deadlock.

I found this link in about deadlocks. In, user @Omry addressed how to avoid deadlocks and why they happen March 11, 2010 at 9:48 AM. User @ewernli adresssed this as well.

This involves the queries that access the same set of tables in different order from one query to the next.

Leave a Reply

Your email address will not be published. Required fields are marked *