mysql数据库如何统计各个表的大小

December 29th, 2009 by Bruce Dou Views:132

一条查询可以搞定:

select table_schema,
sum(data_length+index_length)/1024/1024 as total_mb,
sum(data_length)/1024/1024 as data_mb,
sum(index_length)/1024/1024 as index_mb,
count(*) as tables
from information_schema.tables
group by table_schema
order by 2 desc;

另:合适增加使用index可以提高查询效率,但不可滥用。

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay
  • 豆瓣
  • DZone
  • LinkedIn
  • MySpace
  • Reddit
  • RSS

Also see:

  • No Related Post

Leave a Reply