查看MySQL数据库各表大小

查看MySQL数据库各表大小,table_schema=数据库名称:

SELECT
  t.table_name,
   concat(round(t.data_len / 1024 / 1024, 2),'MB') data_len
FROM (
  SELECT
    '总共' table_name,
    SUM(DATA_LENGTH) data_len
  FROM information_schema.TABLES
  WHERE table_schema = 'dtoa'
  UNION ALL
  SELECT
    table_name,
    DATA_LENGTH data_len
  FROM information_schema.TABLES
  WHERE table_schema = 'dtoa'
) t ORDER BY t.data_len DESC

 

posted on 2016-04-28 13:59  Li Kui  阅读(391)  评论(0编辑  收藏  举报