首页 > 代码库 > 查看mysql 数据表的真实大小空间情况
查看mysql 数据表的真实大小空间情况
select count(*) from t1;
+----------+
| count(*) |
+----------+
| 5 |
+----------+
SELECT table_name,
data_length/1024/1024 AS ‘data_length(MB)‘,
index_length/1024/1024 AS ‘index_length(MB)‘,
(data_length + index_length)/1024/1024 AS ‘total(MB)‘
FROM information_schema.tables
WHERE table_schema=‘test‘
AND table_name = ‘t1‘;
+------------+-----------------+------------------+------------+
| table_name | data_length(MB) | index_length(MB) | total(MB) |
+------------+-----------------+------------------+------------+
| t1 0.01562500 | 0.00000000 | 0.01562500 |
+------------+-----------------+------------------+------------+
从上面可以看出在磁盘上的数据大小是12G,而实际的大小才0.01562500MB(估计值),在种情况使用逻辑迁移是再好不过的了。
防止伪大表出现。
本文出自 “梦想照进现实” 博客,请务必保留此出处http://lookingdream.blog.51cto.com/5177800/1906244
查看mysql 数据表的真实大小空间情况