mysql数据库容量查询

1、统计每张表的数据量
SELECT
*
FROM
(
select
TABLE_NAME,
concat(
round(
sum(DATA_LENGTH / 1024 / 1024 ),
7
)

) as size
from
information_schema. tables
where
table_schema = 'platform_all_edu'
GROUP BY
table_name
) t;

2、统计每张表的数据容量(数据量+索引)
select
table_name,
(
sum(DATA_LENGTH) + sum(INDEX_LENGTH)
) / 1024 / 1024 as size
from
information_schema. tables
where
table_schema = 'platform_all_edu'
GROUP BY
table_name;

3、查看数据库数据量

SELECT concat(round(sum(DATA_LENGTH / 1024 / 1024 / 1024), 2), 'G')
FROM information_schema. tables
WHERE table_schema= 'platform_all_edu' ;

posted @ 2016-08-09 09:58  木子小僧  阅读(5396)  评论(0编辑  收藏  举报