
+ --------------------- +
设置1行(0.03秒)
2. 检查哪些表具有更多历史数据,您可以看到history和history_uint具有最多的历史数据. 此外,trends_trends_uint中还有一些数据.
[其他优化方法: ]
mysql>选择table_namezabbix,(data_length + index_length)/ 1024/1024作为total_mb,来自information_schema.tables的table_rows其中table_schema ='zabbix';
3. 例如,要在2015年11月25日之前删除数据
mysql> selectfrom_unixtime(1448455901,'%Y%m%d');

+ ------------------------------------ +
| from_unixtime(1448455901,'%Y%m%d')|
+ ------------------------------------ +
| 20151125 |
+ ------------------------------------ +
组1行(0.00秒)
mysql>选择from_unixtime(1448440330,'%Y%m%d');

+ ------------------------------------ +
| from_unixtime(1448440330,'%Y%m%d')|
+ ------------------------------------ +
| 20151125 |
+ ------------------------------------ +
组1行(0.00秒)
mysql>选择from_unixtime(1451879603,'%Y%m%d'); [向表中的红色数字,可以使用Navicat工具查看]

+ ------------------------------------ +
| from_unixtime(1451879603,'%Y%m%d')|
+ ------------------------------------ +
| 20160103 |
+ ------------------------------------ +
组1行(0.00秒)
mysql>从history_uint的时钟中删除<1451879603;

查询正常,受影响的行数为4681587(5分钟54.44秒)
mysql>优化表history_uint; //删除数据后的优化【】
mysql>从历史记录中删除时钟<1451879603;
查询正常,受影响3649219行(7分钟1.21秒)
mysql>优化表历史记录;
【mysql>从`history` WHERE`clock`中删除 查询确定zabbix,受影响的0行,65535警告(3.32秒)] ----->无法执行此步骤! mysql>刷新权限;
本文来自电脑杂谈,转载请注明本文网址:
https://www.pc-fly.com/a/ruanjian/article-269204-1.html