MySQL表、索引大小查询

select 

    table_schema, table_name,

    table_rows, -- 表数据行数

   round(sum(data_length)/1024/1024,2) data_size, -- 表数据所占空间大小(M)

   round(sum(index_length)/1024/1024,2)  index_size -- 表索引所占空间大小(M)

from information_schema.tables 

group by table_schema, table_name

order by data_size desc

猜你喜欢

转载自blog.csdn.net/suoyx/article/details/112862926
今日推荐