mysql数据库查询库中所有表所占空间大小

时间:2023-03-08 15:41:14
mysql数据库查询库中所有表所占空间大小
SELECT
CONCAT(table_schema,'.',table_name) AS 'TABLE_NAME',
CONCAT(ROUND(table_rows / 1000000, 4),'M') AS 'ROW_SIZE',
CONCAT(ROUND(data_length / (1024 * 1024),2),'M') AS 'DATA_SIZE',
CONCAT(ROUND(index_length / (1024 * 1024),2),'M') AS 'INDEX_SIZE',
CONCAT(ROUND((data_length + index_length) / (1024 * 1024),2),'M') AS 'TOTAL_SIZE'
FROM
information_schema. TABLES
WHERE
table_schema = 'bootdo'
ORDER BY 3 desc;