mysql查看库、表占用存储空间大小
查看该数据库实例下所有库大小,得到的结果是以MB为单位 select table_schema, sum(data_length)/1024/1024 as data_length, sum(index_length)/1024/1024 as index_length, sum(data_length+index_length)/1024/1024 as sum from information_schema.tables; ## 查看mysql的库和索引的占用磁盘大小 select concat(truncate(sum(data_length)/1024/1024,2),'mb') as data_size, concat(truncate(sum(max_data_length)/1024/1024,2),'mb') as max_data_size, concat(truncate(sum(data_free)/1024/1024,2),'mb') as data_free, concat(truncate(sum(index_length)/1024/1024,2),'mb') as index_size from information_schema.tables where table_schema = 'parkcloud_test'; ## 查看mysql库下数据表的占用磁盘大小 select table_name, (data_length/1024/1024) as data_mb , (index_length/1024/1024) as index_mb, ((data_length+index_length)/1024/1024) as all_mb, table_rows from information_schema.tables where table_schema = 'parkcloud_test';
0 条评论