delete from '表' where '字段' = '值' 会发现删除失败
报错:lock wait timeout exceed.删除大量数据时还有可能造成数据库死锁。
建议通过 limit 关键字分批清理,例如:
delete from '表' where '字段' = '值' order by '字段2' limit 10000;
建议:平时 update 和 delete 时最好也加上 limit 1 来防止误操作。
delete from '表' where '字段' = '值' 会发现删除失败
报错:lock wait timeout exceed.删除大量数据时还有可能造成数据库死锁。
建议通过 limit 关键字分批清理,例如:
delete from '表' where '字段' = '值' order by '字段2' limit 10000;
建议:平时 update 和 delete 时最好也加上 limit 1 来防止误操作。