[ MySql ] 查找大表和清理
查看整个库的大小
select concat(round(sum(data_length / 1024 / 1024), 2), 'MB') as data
from information_schema.tables
where table_schema = 'schemaName';
查看表的大小
select TABLE_NAME, concat(round(data_length / 1024 / 1024), 'MB') 'size'
from information_schema.tables
where table_schema = 'schemaName'
order by DATA_LENGTH desc
这里的单位是MB可以自己改,我这边是按照从大到小的顺序排列的。找到表后 可使用
truncate
或delete
删除