并发批量更新tableA的field3字段。
注:tableA有非主键索引 idx_field1(field1) , idx_field2(field2)
update tableA set field3 = '3' where field1='arg1' and field2='arg2'
报错:
Cause: com.mysql.cj.jdbc.exceptions.MySQLTransactionRollbackException: Deadlock found when trying to get lock; try restarting transaction
; Deadlock found when trying to get lock; try restarting transaction; nested exception is com.mysql.cj.jdbc.exceptions.MySQLTransactionRollbackException: Deadlock found when trying to get lock; try restarting transaction

解决方式一:
/* 主键更新 */
update tableA set field3 = '3' where id = 'id1'
417

被折叠的 条评论
为什么被折叠?



