mysql 数据库大小

information_schema库中包含了对整个数据库的很多统计信息,可以通过查看它们,来得到数据库相关的信息。

 

mysql> use information_schema;
Database changed


mysql> select count(1) as tables, concat(round(sum(table_rows)/1000000,2),'M') as rows, concat(round(sum(data_length)/(1024*1024*1024),2),'G') as data, concat(round(sum(index_length)/(1024*1024*1024),2),'G') as idx, concat(round(sum(data_length+index_length)/(1024*1024*1024),2),'G') as total_size,round(sum(index_length)/sum(data_length),2) as idxfrac from tables;
+--------+--------+--------+-------+------------+---------+
| tables | rows   | data   | idx   | total_size | idxfrac |
+--------+--------+--------+-------+------------+---------+
|    719 | 96.41M | 30.17G | 9.63G | 39.80G     |    0.32 |
+--------+--------+--------+-------+------------+---------+
1 row in set (1 min 9.64 sec)

 

 

 

你可能感兴趣的:(数据库,mysql,schema,table,数据库相关)