首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
社区首页 >问答首页 >mysql 使用insert on duplicate key update 死锁,怎么解决?

mysql 使用insert on duplicate key update 死锁,怎么解决?

提问于 2024-09-06 10:41:04
回答 0关注 0查看 21

类似这个文档的表 https://cloud.tencent.com/developer/article/1903511?pos=comment

你好,我遇到了insert into `identity_info`(`identity_id`,`name`) values('123456789012345678','王五') on duplicate key update `name` = '王五';

死锁的情况,除了自增主键,只有一个唯一索引,以及其他三个联合索引(不唯一),在两个并发的事务执行的sql,唯一索引的值也不同,且表中不存在与它们重复的唯一索引。最终报错:Lock wait timeout exceeded; try restarting transaction。通过公司的工具得知两个事务相互阻塞超过50秒。

回答

和开发者交流更多问题细节吧,去 写回答
相关文章

相似问题

相关问答用户
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档