MySQL 删除数据 批量删除(大量)数据_mysql 批量删除-优快云博客
MySQL删除大批量数据_mysql8 大表 rename-优快云博客
文档引自以上文件。
昨天,有小伙伴面试说,面试时遇到这个问题。于是我总结了一下。
一、删除大表的部分数据
一个表有1亿6000万的数据,有一个自增ID。最大值就是1亿6000万,需要删除大于250万以后的数据,有什么办法可以快速删除?
看到mysql文档有一种解决方案:http://dev.mysql.com/doc/refman/5.0/en/delete.html
If you are deleting many rows from a large table, you may exceed the lock table size for an InnoDB table. To avoid this problem, or simply to minimize the time that the table remains locked, the following strategy (which does not use DELETE at all) might be helpful:
Select the rows not to be deleted into an empty table that has the same structure as the
MySQL表数据删除方法总结

最低0.47元/天 解锁文章
951

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



