查看MySQL表大小相关信息

一:查询所有数据的大小
mysql> select concat(round(sum(DATA_LENGTH/1024/1024), 2), 'MB') as data from TABLES;
+------------+
| data           |
+------------+
| 43581.77MB |
+------------+
1 row in set, 1 warning (9.84 sec)

二:查看指定数据库的大小
mysql> select concat(round(sum(DATA_LENGTH/1024/1024), 2), 'MB') as data from TABLES where table_schema='wo';
+------------+
| data           |
+------------+
| 20833.77MB |
+------------+
1 row in set (0.00 sec)

三:查看数据库表的大小 wodfan库spider_sku表
mysql>  select concat(round(sum(DATA_LENGTH/1024/1024),2),'MB') as data,concat(round(sum(index_length/1024/1024),2),'MB') as index_mb from TABLES where table_schema='wo' and table_name='spider';
+-----------+----------+
| data      | index_mb |
+-----------+----------+
| 4413.00MB | 824.75MB |
+-----------+----------+
1 row in set (0.00 sec)
posted @ 2015-02-24 18:07  study-notes  阅读(186)  评论(0编辑  收藏  举报