查看数据表大小

// 表
select TABLE_NAME AS '表名',DATA_LENGTH/1024/1024 AS '数据大小(M)', INDEX_LENGTH/1024/1024 AS '索引大小(M)',TABLE_ROWS/10000 AS '数据量(万)'  from information_schema.TABLES where information_schema.TABLES.TABLE_SCHEMA = 'duobaohui' and information_schema.TABLES.TABLE_NAME = 'comment'\G;

// 数据库
select concat(round(sum(data_length/1024/1024),2),'MB') as '数据库大小' from tables where table_schema='duobaohui';

猜你喜欢

转载自ww111.iteye.com/blog/1900491