mysql 查看大表,查看个表占用大小
Posted AngDH
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql 查看大表,查看个表占用大小相关的知识,希望对你有一定的参考价值。
use information_schema; -- 查看 各库 占用 大小 select TABLE_SCHEMA, concat(truncate(sum(data_length)/1024/1024,2),‘ MB‘) as data_size, concat(truncate(sum(index_length)/1024/1024,2),‘MB‘) as index_size from information_schema.tables group by TABLE_SCHEMA order by data_length desc; -- 查看某个库 各表 占用 情况 select TABLE_NAME, concat(truncate(data_length/1024/1024,2),‘ MB‘) as data_size, concat(truncate(index_length/1024/1024,2),‘ MB‘) as index_size from information_schema.tables where TABLE_SCHEMA = ‘ku_ming‘ group by TABLE_NAME order by data_length desc; -- 查看 某个库 某个表 占用 情况 select table_name,concat(round(sum(data_length/1024/1024),2),‘MB‘) as data from tables where table_schema=‘ku_ming‘ and table_name=‘tablename‘;
以上是关于mysql 查看大表,查看个表占用大小的主要内容,如果未能解决你的问题,请参考以下文章