SELECT
table_schema AS '数据库',
table_name AS '表名',
table_rows AS '记录数',
TRUNCATE(data_length/1024/1024, 2) AS '数据容量(MB)',
TRUNCATE(index_length/1024/1024, 2) AS '索引容量(MB)'
FROM information_schema.tables
WHERE table_schema = 'xxxs'
ORDER BY table_schema ASC, data_length DESC, index_length DESC;
这个语言返回的记录数和实际该表中的数据量.是不一致的.是什么原因呢?