查询Mysql数据表的行数、数据大小、索引大小和总大小

查询的sql如下:

SELECT CONCAT(table_schema,'.',table_name) AS 'Table Name', 
    table_rows AS 'Number of Rows', -- 行数
    CONCAT(ROUND(data_length/(1024*1024*1024),6),' G') AS 'Data Size',  -- 数据大小
    CONCAT(ROUND(index_length/(1024*1024*1024),6),' G') AS 'Index Size' ,  -- 索引大小 
    CONCAT(ROUND((data_length+index_length)/(1024*1024*1024),6),' G') AS'Total' -- -总大小
FROM information_schema.TABLES 
WHERE table_schema LIKE 'ry';

猜你喜欢

转载自blog.csdn.net/fd2025/article/details/125499879