mysql 查看某数据库各个表容量大小SQL

kevin.Zhu 发布于:2021-4-15 9:28 分类:文摘  有 16 人浏览,获得评论 0 条  

https://www.cnblogs.com/wbl001/p/11880270.html


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;