Mysql查看某个表大小

查看指定表的大小
select concat(round(sum(DATA_LENGTH/1024/1024),2),‘MB’) as data from TABLES where table_schema=‘库名’ and table_name=‘表名’;

查看指定数据库的大小
select concat(round(sum(DATA_LENGTH/1024/1024),2),‘MB’) as data from TABLES where table_schema=‘库名’;

查看所有表大小并排序
SELECT CONCAT(table_schema,’.’,table_name) AS ‘Table Name’, CONCAT(ROUND(table_rows/1000000,4),‘M’) AS ‘Number of Rows’, CONCAT(ROUND(data_length/(102410241024),4),‘G’) AS ‘Data Size’,CONCAT(ROUND(index_length/(102410241024),4),‘G’) AS ‘Index Size’, CONCAT(ROUND((data_length+index_length)/(102410241024),4),‘G’) AS’Total’FROM information_schema.TABLES ORDER BY --total DESC;

猜你喜欢

转载自blog.csdn.net/u014609263/article/details/87934638