mysql查询表的数据大小

1、查询数据库所占的容量

select sum(DATA_LENGTH)+sum(INDEX_LENGTH) from information_schema.tables 
where table_schema='DN';

select concat(round(sum(data_length/1024/1024),2),'MB') as data from tables where table_schema='DN';

2、查询所有的数据大小

select concat(round(sum(DATA_LENGTH/1024/1024),2),'M') from tables;

3、查询某个表的数据

select concat(round(sum(DATA_LENGTH/1024/1024),2),'M') from tables where table_schema=’DN’ AND table_name=’TN’; 

 

posted @ 2017-04-13 08:51  yudis  阅读(250)  评论(0编辑  收藏  举报