- 论坛徽章:
- 15
|
本帖最后由 rdcwayx 于 2014-09-05 20:18 编辑
这个是用于查找数据库大小的命令。- SELECT table_schema , sum( data_length + index_length ) / 1024 / 1024 "Data Base Size in MB" FROM information_schema.TABLES GROUP BY table_schema;
复制代码 用的sql管理软件是: MysqlWorkbench
数据库版本是: mysql (5.5.27)
这个命令可以用来查找最大的几个table size- SELECT table_name AS "Tables",
- round(((data_length + index_length) / 1024 / 1024), 2) "Size in MB"
- FROM information_schema.TABLES
- WHERE table_schema = 'zabbix'
- ORDER BY (data_length + index_length) DESC;
复制代码 我这边运行了这个命令后, 就这个两个table: history_uint (30GB) 和 history (24GB) 就用掉几乎全部的空间了。 这样的话,目标已经找到。
再运行这个命令, 用来确认是否有日期行。 可惜没有,那么就不能按照日期来删除记录了- desc history_uint
- field, type, null, key, default,extra
复制代码 最后就剩下trancate命令了:- truncate table history;
- truncate table history_uint;
复制代码 |
|