delete from '表' where '字段' = '值' 會(huì)發(fā)現(xiàn)刪除失敗
報(bào)錯(cuò):lock wait timeout exceed.刪除大量數(shù)據(jù)時(shí)還有可能造成數(shù)據(jù)庫死鎖癌蚁。
建議通過 limit 關(guān)鍵字分批清理例诀,例如:
delete from '表' where '字段' = '值' order by '字段2' limit 10000;
建議:平時(shí) update 和 delete 時(shí)最好也加上 limit 1 來防止誤操作累奈。