清理8组nodes中表的历史数据,平均每个node中的表有1.5亿条记录,需要根据date_created字段清理8000W数据记录,这个字段没有索引。
环境介绍
线上磁盘空间不足,truncate了许多能动的表,磁盘空间还是占据了87%,我们的nagios报警阀值是80%。所以不断的还会收到email以及短信报警。需要根据时间字段date_created清理,但是在设计之初由于当初的开发人员考虑不足所以date_created字段没有建立索引。另外这些数据可以不用备份,直接删除掉。
问题来了,这么大记录量的表,根据date_created字段删除记录,而且还没有索引,难度肯定非常大。enl.ibd文件大小29G大小,磁盘剩余空间32G,两者差距比较小。
[mysql@xxxx-xxx ide]$ ll -h enl.ibd
-rw-rw---- 1 mysql mysql 29G Aug 30 07:21 enl.ibd
方案策划中,大概准备采用shell命令。
虽然date_created 没有索引,但是我们做过实验
mysql> select * from enl where date_created < "2013-01-01 00:00:00" limit 1000;
......
1000 rows in set (0.00 sec)
看来执行效果还不错,那再试下delete效果
mysql> delete from enl where date_created < "2013-01-01 00:00:00" limit 1000;
Query OK, 1000 row affected (2.00 sec)
看起来可以每次删除1000条,写脚本delete吧
for ((i=0;i<1000000;i++));do mysql -uroot -e 'use iden;delete from enl where date_created < "2013-01-01 00:00:00" limit 1000;';done
等delete操作完成之后,找业务低峰期执行alter table enl engine=innodb;来释放磁盘空间。
分享到:
相关推荐
无线传感器网络随机分布节点,形成拓扑结构
mldonkey需要的nodes.dat
结点地图 nodes_map_src_20130612.rar
1. Scope of this Volume.......................................................................................1 2. Installing the ros-by-example Code......................................................
nodes_map_src_20130602.rar 基于双闭包不相交的结点图
内含100万个节点,可用于计算连通分量的各类算法(Union-Find、Quick-Find等)的测试。
| |__ xdma_rw/ - Utility for reading/writing to/from xdma device nodes such | | as control, user, bypass, h2c_0, c2h_0 etc. | |__ xdma_test/ - Basic test application which performs H2C/C2H transfers...
node.js官网已经下载不了以往的版本了。只能在github下载了,但是gighub已经被和谐了。好不容易找到的10版本,分享!!!
配电网潮流计算源程序,可直接运行的,修改输入数据即可
1 Scope 1 2 Normative references 2 3 Terms and definitions 3 4 General principles 7 4.1 Implementation compliance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 4.2 Structure ...
第 1 章Redis 介绍. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 第 2 章数据类型初探. . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...
路由选路算法距离向量算法的编程实现,c
1 Introduction to Oracle Service Bus 2 Tasks Working with Projects, Folders, Resources, and Configurations ................................................... 2-1 Resource Naming Restrictions ...........
历史与趋势数据详解 95 作者:凉白开 版本:v3.0.1 网址:http://www.ttlsa.com(运维生存时间) 2 / 368 zabbix zabbix自定义用户自定义用户keykey与参数与参数User parametersUser parameters ......................
simple d2d underlay communication with 500 nodes
有趣小项目!!!有趣小项目!!!有趣小项目!!!有趣小项目!!!
## UR5 Realtime client Lightweight python library for controlling UR5 robot from Universal Robot family. Robot kinematics are calculated based on the following paper: [tech report]...
第 1 章Redis 介绍. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 第 2 章数据类型初探. . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...
有关贝塞尔曲面的显示,主程序例如bezier_surface_display.m,只要导入节点和矩形数据就可以了。 例如bezier_surface_display ( teacup_nodes.txt , teacup_rectangles.txt )
mldonkey nodes.dat~~~