一个表占用空间的大小,相当于是 数据大小 + 索引大小,
示例:
1.想查看hx库的所有表大小,可以使用:SELECT TABLE_NAME,DATA_LENGTH+INDEX_LENGTH,TABLE_ROWS FROM information_schema.TABLES WHERE TABLE_SCHEMA='hx';
+-------------------+--------------------------+------------+
| TABLE_NAME | DATA_LENGTH+INDEX_LENGTH | TABLE_ROWS |
+-------------------+--------------------------+------------+
| enjoy_data | 6979584 | 70113 |
| hx_record | 113410048 | 753279 |
| VeVb_record | 21835546624 | 104917777 |
| tmp_day_id | 17326 | 811 |
+-------------------+--------------------------+------------+
2.想查看hx库的enjoy表大小,可以使用:
SELECT DATA_LENGTH+INDEX_LENGTH,TABLE_ROWS FROM information_schema.TABLES WHERE TABLE_SCHEMA='hx' AND TABLE_NAME = 'enjoy_data';
返回:
+--------------------------+------------+
| DATA_LENGTH+INDEX_LENGTH | TABLE_ROWS |
+--------------------------+------------+
| 6979584 | 70113 |
+--------------------------+------------+
新闻热点
疑难解答