作者x9060000456 (你好)
看板Database
标题[SQL ] Deadlock found when trying to get lock
时间Sat Dec 8 20:53:03 2018
(针对
SQL 语言的问题,用这个标题。请用 Ctrl+Y 砍掉这行)
资料库名称: mysql
资料库版本: 5.7
内容/问题描述:
各位大大安安大家好
目前使用 python 订阅伺服器接收资料
再更新 DB 的资料
1 秒内更新约 20~30 笔资料,
资料接收格式如下:
更新第 1 次
marketId credit
1 2
2 3
3 3
4 4
5 6
6 7
更新第 2 次
marketId credit
2 3
3 6
5 4
6 5
7 2
8 4
更新第 3 次
marketId credit
1 3
3 4
5 2
6 1
7 2
8 6
...
更新第 N 次
marketId credit
2 3
3 1
4 3
6 7
7 5
9 4
以上皆是每 1 秒收到资料
更新同一张 table
query 如下:
UPDATE marketTable SET credit = %s where marketId =%s
现在写回圈执行,
有时候成功 update,
有时候出现
Error: (1213, 'Deadlock found when trying to get lock; try restarting
transaction')
故到板上求救><
谢谢各位大大们!
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 36.226.81.195
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Database/M.1544273586.A.106.html
1F:推 rockchangnew: 有建索引吗? 12/09 20:46