我的数据库是mysql5.7,innodb,已提交隔离级别。我害怕死锁,所以我保持mysql sql语句简单,只有:
insert into ... where ...insert into ... where ... on duplicate key update例如:连接exec insert into ... where ...;一次,永远不要执行多语句insert ... where ...; update ... where ...; where语句具有唯一的
If there are no such subscribers, I can insert it (两个线程都执行第一个select,得到零结果,然后都执行insert。我们尝试使用SELECT ...对于更新和选择...LOCK IN SHARE模式,但是我们得到了死锁,这对数据库服务器来说是繁重的操作。对于测试,我们打开了两个终端,并一步一步地做了:mysql> star
带表request_action的MySQL DB 5.6 (不带自动增量但增量在触发器中的复合主键,如下所示): `ra_id`= (SELECT COALESCE(MAX(ra_id)+1, 1) FROM request_action WHERE cl_id = NEW.cl_id);并且我在一天中有很多次死锁19952598, OS thread handle 0x7f5e10e38700, query id 248552715 192.168.0.7 vh_uo