Comments on: Dealing with deadlocks in a busy MySQL server http://www.xaprb.com/blog/2012/08/31/dealing-with-deadlocks-in-a-busy-mysql-server/ Stay curious! Thu, 02 May 2013 12:36:53 +0000 hourly 1 http://wordpress.org/?v=3.5.1 By: Xaprb http://www.xaprb.com/blog/2012/08/31/dealing-with-deadlocks-in-a-busy-mysql-server/#comment-20203 Xaprb Mon, 03 Sep 2012 23:59:12 +0000 http://www.xaprb.com/blog/?p=1525#comment-20203 Daniël, to your last point, I sometimes use application locks around parts of code that tend to deadlock with each other. I’ll have each likely-to-deadlock process execute SELECT GET_LOCK('some verb', $timeout) before doing the likely-to-deadlock queries. This serializes access without impacting other things that are accessing the data in question. It isn’t always a good idea but I’ve found it to help sometimes.

]]>
By: Daniël van Eeden http://www.xaprb.com/blog/2012/08/31/dealing-with-deadlocks-in-a-busy-mysql-server/#comment-20201 Daniël van Eeden Mon, 03 Sep 2012 05:29:31 +0000 http://www.xaprb.com/blog/?p=1525#comment-20201 There are some other solutions to prevent deadlocks:
- InnoDB uses the index for locking. Changing the index could help.
- Split long transactions in shorter ones.
- A real serializable transaction isolation.
- locking complete tables, not just rows. (forces transactions to wait on each other)

]]>