MySQL怎么查看表占用空间大小

发布时间:2021-08-23 15:07 来源:亿速云 阅读:0 作者:chen 栏目: Mysql 欢迎投稿:712375056

这篇文章主要介绍“怎么查看表占用空间大小”,在日常操作中,相信很多人在MySQL怎么查看表占用空间大小问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”MySQL怎么查看表占用空间大小”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!

//先进去MySQL自带管理库:information_schema   
//自己的数据:dbwww58com_kuchecarlib   
//自己的表:t_carmodelparamvalue  
  
mysql> use information_schema;  
Database changed  
mysql> select data_length,index_length  
    -> from tables where  
    -> table_schema='dbwww58com_kuchecarlib'  
    -> and table_name = 't_carmodelparamvalue';  
+-------------+--------------+  
| data_length | index_length |  
+-------------+--------------+  
|   166379520 |    235782144 |  
+-------------+--------------+  
row in set (0.02 sec)  
  
mysql> select concat(round(sum(data_length/1024/1024),2),'MB') as data_length_MB,  
    -> concat(round(sum(index_length/1024/1024),2),'MB') as index_length_MB  
    -> from tables where  
    -> table_schema='dbwww58com_kuchecarlib'  
    -> and table_name = 't_carmodelparamvalue';  
+----------------+-----------------+  
| data_length_MB | index_length_MB |  
+----------------+-----------------+  
| 158.67MB       | 224.86MB        |  
+----------------+-----------------+  
row in set (0.03 sec)

免责声明:本站发布的内容(图片、视频和文字)以原创、来自本网站内容采集于网络互联网转载等其它媒体和分享为主,内容观点不代表本网站立场,如侵犯了原作者的版权,请告知一经查实,将立刻删除涉嫌侵权内容,联系我们QQ:712375056,同时欢迎投稿传递力量。