如何查看MySQL数据库表容量大小

  介绍

如何查看MySQL数据库表容量大小?很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。

1。查看所有数据库容量大小

select    table_schema  as  & # 39;数据库& # 39;,   总和(table_rows), as  & # 39;记录数& # 39;,   sum(截断(data_length/1024/1024,, 2)), as  & # 39;数据容量(MB) & # 39;,   sum(截断(index_length/1024/1024,, 2)), as  & # 39;索引容量(MB) & # 39;   得到information_schema.tables   group  by  table_schema   order  by 和(data_length), desc,,总和(index_length), desc;

2。查看所有数据库各表容量大小

select    table_schema  as  & # 39;数据库& # 39;,   table_name  as  & # 39;表名& # 39;,   table_rows  as  & # 39;记录数& # 39;,   截断(data_length/1024/1024,, 2), as  & # 39;数据容量(MB) & # 39;,   截断(index_length/1024/1024,, 2), as  & # 39;索引容量(MB) & # 39;   得到information_schema.tables   order  by  data_length  desc, index_length  desc;

3。查看指定数据库容量大小

例:查看mysql库容量大小

select    table_schema  as  & # 39;数据库& # 39;,   总和(table_rows), as  & # 39;记录数& # 39;,   sum(截断(data_length/1024/1024,, 2)), as  & # 39;数据容量(MB) & # 39;,   sum(截断(index_length/1024/1024,, 2)), as  & # 39;索引容量(MB) & # 39;   得到information_schema.tables   where  table_schema=& # 39; MySQL # 39;;

如何查看MySQL数据库表容量大小”>,<br/> </p> <p> 4。查看指定数据库各表容量大小</p> <p>例:查看mysql库各表容量大小</p> <pre类= select    table_schema  as  & # 39;数据库& # 39;,   table_name  as  & # 39;表名& # 39;,   table_rows  as  & # 39;记录数& # 39;,   截断(data_length/1024/1024,, 2), as  & # 39;数据容量(MB) & # 39;,   截断(index_length/1024/1024,, 2), as  & # 39;索引容量(MB) & # 39;   得到information_schema.tables   where  table_schema=& # 39; mysql # 39;   order  by  data_length  desc, index_length  desc;

如何查看MySQL数据库表容量大小

看完上述内容是否对您有帮助呢?如果还想对相关知识有进一步的了解或阅读更多相关文章,请关注行业资讯频道,感谢您对的支持。

如何查看MySQL数据库表容量大小