MySQL 의 database 와 table 의 size 를 알아내는 방법
MySQL 의 database 와 table 의 size 를 알아내는 방법 (mysql 5버전 이상)
DB_NAME 에 사이즈를 알고 싶은 database 를 넣으면 모든 테이블의 사이즈가 출력됨
show databaes; ( 데이터베이스 목록 나열)
SELECT TABLE_NAME AS "Tables",
round(((data_length + index_length) / 1024 / 1024), 2) "Size in MB"
FROM information_schema.TABLES
WHERE table_schema = "DB_NAME"
ORDER BY (data_length + index_length) DESC;
SELECT TABLE_NAME AS "Tables",
round(((data_length + index_length) / 1024 / 1024), 2) "Size in MB"
FROM information_schema.TABLES
WHERE table_schema = "TCCMain"
ORDER BY (data_length + index_length) DESC;
(METRO911)
SELECT TABLE_NAME AS "Tables",
round(((data_length + index_length) / 1024 / 1024), 2) "Size in MB"
FROM information_schema.TABLES
WHERE table_schema = "METRO911"
ORDER BY (data_length + index_length) DESC;
SELECT TABLE_NAME AS "Tables",
round(((data_length + index_length) / 1024 / 1024), 2) "Size in MB"
FROM information_schema.TABLES
WHERE table_schema = "GEPON"
ORDER BY (data_length + index_length) DESC;