>  기사  >  데이터 베이스  >  MYSQL查询数据库表索引的硬盘空间占用_MySQL

MYSQL查询数据库表索引的硬盘空间占用_MySQL

WBOY
WBOY원래의
2016-06-01 13:29:261455검색

bitsCN.com

查询数据库的占用

SELECT CONCAT(ROUND(SUM(index_length)/(1024*1024), 2), ' MB')
AS 'Total Index Size'
, CONCAT(ROUND(SUM(data_length)/(1024*1024), 2), ' MB') AS 'Total Data Size'
FROM information_schema.TABLES
where table_schema like 'edb_a%' ;

 

查询表的占用

SELECT CONCAT(table_schema,'.',table_name) AS 'Table Name',
CONCAT(ROUND(table_rows/1000000,2),'M') AS 'Number of Rows',
CONCAT(ROUND(data_length/(1024*1024*1024),2),'G') AS 'Data Size',
CONCAT(ROUND(index_length/(1024*1024*1024),2),'G') AS 'Index Size' ,
CONCAT(ROUND((data_length+index_length)/(1024*1024*1024),2),'G')
AS'Total'FROM information_schema.TABLES
WHERE table_schema LIKE 'edb_a%';

bitsCN.com
성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.