mysql查看当前所有的数据库和索引大小

SELECT
    table_schema,
    concat(
        TRUNCATE (
            sum(data_length) / 1024 / 1024,
            2
        ),
        ' mb'
    ) AS data_size,
    concat(
        TRUNCATE (
            sum(index_length) / 1024 / 1024,
            2
        ),
        'mb'
    ) AS index_size
FROM
    information_schema. TABLES
#where table_schema = 'youdb'
GROUP BY table_schema ORDER BY data_length DESC;

 

posted @ 2021-06-02 17:25  已老  阅读(132)  评论(0)    收藏  举报