Linux机器上mysql 5.6中表的data dir的大小是否比从information-schema.table s查询中得到的大小大得多?
文件系统(/data/)的大小是11g,
而下面的查询返回5g
SELECT sum(ROUND(((DATA_LENGTH + INDEX_LENGTH ) / 1024 / 1024),2)) AS size FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='my-table-name
我遗漏了什么吗?
total | free | data | index_data |
4597.85937500 | 613.00000000 | 4089.40625000 | 508.45312500 |
最佳答案
以下是用于查找数据库大小的脚本:
SELECT
table_schema "DB Name",
Round(Sum(data_length + index_length) / 1024 / 1024, 1) "DB Size in MB" FROM
information_schema.tables where table_schema ='schema name' ;
运行此查询并显示输出:
select (sum(data_length) + sum(INDEX_LENGTH))/ 1024 / 1024 as total,
sum(data_free)/ 1024 / 1024 as free ,
sum(data_length)/ 1024 / 1024 as data,
sum(INDEX_LENGTH/ 1024 / 1024) as index_data
from information_schema.tables t
where t.TABLE_SCHEMA = 'schema name';
关于mysql - MySQL表数据目录大于从information_schema.tables计算的大小,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/22672200/