MySQL 查看某数据库中表容量的大小


MySQL 查看数据库中各个表容量的大小。

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 = 'dbname' -- 数据库名字改为对应数据库名称
ORDER BY
    table_rows DESC;


posted @ 2021-09-27 21:48  做梦当财神  阅读(82)  评论(0编辑  收藏  举报