trx
Published on 2024-08-12 / 37 Visits
0

查询Mysql库表大小

SELECT
table_schema AS 'Database',
table_name AS 'Table',
ROUND((data_length + index_length) / 1024 / 1024, 2) AS 'Size (MB)'
FROM
information_schema.TABLES
WHERE
table_schema = 'abc' AND
table_name = 'abc_table';


SELECT
    table_schema AS '数据库',
    ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) AS '总大小(MB)'
FROM
    information_schema.TABLES
WHERE
    table_schema = 'abc'
GROUP BY
    table_schema;