Skip to content

第35章 删除不存在的数据造成死锁

xiaoboluo768 edited this page Jun 18, 2020 · 3 revisions

35.4 表结构及操作步骤

mysql> CREATE TABLE t1 (id int unsigned NOT NULL PRIMARY KEY) ;
mysql> INSERT INTO t1 VALUES (1), (5);
  • 表35-1
Session 1 Session 2
START TRANSACTION;DELETE FROM t1 WHERE id = 2;
START TRANSACTION;DELETE FROM t1 WHERE id = 4;
INSERT INTO t1 VALUES (2);
INSERT INTO t1 VALUES (4);//发生死锁

上一篇:第34章 并发删除数据造成死锁 | 下一篇:第36章 插入意向锁死锁

Clone this wiki locally