表结构:CREATETABLE`test_lock`(`id`int(10)unsignedNOTNULLAUTO_INCREMENT,PRIMARYKEY(`id`))ENGINE=InnoDBAUTO_INCREMENT=60DEFAULTCHARSET=utf8隔离级别:REPEATABLE-READinnodb_locks_unsafe_for_binlog:0表内容:+----+|id|+----+|12||39||59|+----+session1:mysql>begin;QueryOK,0rowsaffected(0.00sec)mysql>select*fromtest_lockwhereidinsertintotest_lockvalues(40);问题:1.id是主键,为什么session2还会等待session1的锁呢2.就算有next-keylock,它不应该是锁住(39,59]吗,为什么在session2中插入的值是70时还会等待呢。
添加回答
举报
0/150
提交
取消