drop table if exists t1; CREATE TABLE `t1` ( `a25` int, `col605` int, `col609` int, PRIMARY KEY (`a25`,`col609`), UNIQUE KEY (`col605`) ) ENGINE=InnoDB; in 15 threads, where ? is random smallint. autocommit=1 and nobody starts/commits trx. insert ignore into `t1` set `a25`=?,`col605`=abs(?) % 1,`col609`=abs(?) ------------------------ LATEST DETECTED DEADLOCK ------------------------ 100421 9:35:04 *** (1) TRANSACTION: TRANSACTION 129E30, ACTIVE 0 sec, OS thread id 4572 inserting mysql tables in use 1, locked 1 LOCK WAIT 4 lock struct(s), heap size 1216, 2 row lock(s) MySQL thread id 34, query id 25668 192.168.1.100 root update insert ignore into `t1` set `a25`=27772,`col605`=abs(5503) % 1,`col609`=abs(-18536) *** (1) WAITING FOR THIS LOCK TO BE GRANTED: RECORD LOCKS space id 0 page no 50 n bits 72 index `PRIMARY` of table `test`.`t1` trx id 129E30 lock_mode X locks gap before rec insert intention waiting Record lock, heap no 5 PHYSICAL RECORD: n_fields 5; compact format; info bits 0 0: len 4; hex 8000755e; asc u^;; 1: len 4; hex 80000391; asc ;; 2: len 6; hex 000000129e3c; asc <;; 3: len 7; hex 80000012ca0084; asc ;; 4: len 4; hex 80000000; asc ;; *** (2) TRANSACTION: TRANSACTION 129E3B, ACTIVE 0 sec, OS thread id 628 inserting mysql tables in use 1, locked 1 4 lock struct(s), heap size 1216, 2 row lock(s) MySQL thread id 37, query id 25679 192.168.1.100 root update insert ignore into `t1` set `a25`=27772,`col605`=abs(5503) % 1,`col609`=abs(-18536) *** (2) HOLDS THE LOCK(S): RECORD LOCKS space id 0 page no 50 n bits 72 index `PRIMARY` of table `test`.`t1` trx id 129E3B lock_mode X locks gap before rec Record lock, heap no 5 PHYSICAL RECORD: n_fields 5; compact format; info bits 0 0: len 4; hex 8000755e; asc u^;; 1: len 4; hex 80000391; asc ;; 2: len 6; hex 000000129e3c; asc <;; 3: len 7; hex 80000012ca0084; asc ;; 4: len 4; hex 80000000; asc ;; *** (2) WAITING FOR THIS LOCK TO BE GRANTED: RECORD LOCKS space id 0 page no 50 n bits 72 index `PRIMARY` of table `test`.`t1` trx id 129E3B lock_mode X locks gap before rec insert intention waiting Record lock, heap no 5 PHYSICAL RECORD: n_fields 5; compact format; info bits 0 0: len 4; hex 8000755e; asc u^;; 1: len 4; hex 80000391; asc ;; 2: len 6; hex 000000129e3c; asc <;; 3: len 7; hex 80000012ca0084; asc ;; 4: len 4; hex 80000000; asc ;; *** WE ROLL BACK TRANSACTION (2) ------------ TRANSACTIONS ------------ Trx id counter 129E3F