怎么用ps做简单网站,企业网站定制收费标准,wordpress页面制作视频,企业网站建设的具体需求mysql删除大表的部分数据好久没写博客。最近项目要上线。下班时间还得陪着老妈。实在没时间更新。今天有人提了一个问题#xff0c; www.2cto.com一个表有1亿6000万的数据#xff0c;有一个自增ID。最大值就是1亿6000万#xff0c;需要删除大于250万以后的数据#xff0c;…mysql删除大表的部分数据好久没写博客。最近项目要上线。下班时间还得陪着老妈。实在没时间更新。今天有人提了一个问题 www.2cto.com一个表有1亿6000万的数据有一个自增ID。最大值就是1亿6000万需要删除大于250万以后的数据有什么办法可以快速删除当时看了一眼数据吓尿了这么大的数据要删除到什么时候啊最要命的锁表肿么办delete是不行了加索引也别想。mysql上delete加low_priorty,quick,ignore估计也帮助不大看到mysql文档有一种解决方案https://dev.mysql.com/doc/refman/5.0/en/delete.htmlIf 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 original table:INSERT INTO t_copy SELECT * FROM t WHERE ... ;Use RENAME TABLE to atomically move the original table out of the way and rename the copy to the original name:RENAME TABLE t TO t_old, t_copy TO t;Drop the original table:DROP TABLE t_old;E文不好简单的翻译下删除达标上的多行数据时innodb会超出lock table size的限制最小化的减少锁表的时间的方案是1选择不需要删除的数据并把它们存在一张相同结构的空表里2重命名原始表并给新表命名为原始表的原始表名3删掉原始表总结一下就是当时删除大表的一部分数据时可以使用 见新表拷贝数据删除旧表重命名的方法。