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;
'데이터베이스' 카테고리의 다른 글
Oracle DB (데이터 베이스) 정보 찾기 (0) | 2020.10.07 |
---|---|
Collation 'euckr_general_ci' is not a compiled collation and is not specified in (0) | 2018.11.14 |
/tmp/mysql.sock' (2) (0) | 2018.11.14 |
테이블 안의 컬럼 값 변경, 수정, update (0) | 2018.11.14 |
데이터 테이블 내용 삭제 (0) | 2018.11.14 |