Created
October 19, 2012 05:41
-
-
Save pgr0ss/3916412 to your computer and use it in GitHub Desktop.
MySQL Deadlock
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE foo (id INT) ENGINE INNODB; | |
-- session 1 session 2 | |
------------------------------------------------------------------------ | |
BEGIN; | |
------------------------------------------------------------------------ | |
BEGIN; | |
------------------------------------------------------------------------ | |
INSERT INTO foo VALUES (1); | |
------------------------------------------------------------------------ | |
INSERT INTO foo VALUES (2); | |
------------------------------------------------------------------------ | |
UPDATE foo SET id = 2 WHERE id = 1; | |
------------------------------------------------------------------------ | |
UPDATE foo SET id = 4 WHERE id = 2; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment