728x90
[ 데이터베이스별 용량 조회 ]
-- Database Size
SELECT table_schema AS 'DatabaseName'
, ROUND(SUM(data_length+index_length)/1024/1024, 1) AS 'Size(MB)'
FROM information_schema.tables
GROUP BY table_schema
ORDER BY 2 DESC; table_schema "bmwgs",
SUM(data_length + index_length) / 1024 / 1024 "Size(MB)"
FROM information_schema.TABLES
GROUP BY table_schema;
[ 테이블별 용량 조회 ]
-- Table Size
SELECT table_name AS 'TableName'
, ROUND(SUM(data_length+index_length)/(1024*1024), 2) AS 'All(MB)'
, ROUND(data_length/(1024*1024), 2) AS 'Data(MB)'
, ROUND(index_length/(1024*1024), 2) AS 'Index(MB)'
FROM information_schema.tables
GROUP BY table_name
ORDER BY data_length DESC;
728x90