MySQL 테이블 사용 용량 확인 방법입니다.
자주 사용은 안해서인지 자주 잊어버려서 메모겸 남겨둡니다.
DB 용량 확인
SELECT
table_schema, sum(data_length) /1024/1024 AS mb
FROM
information_schema.tables
GROUP BY
table_schema
ORDER BY
sum(data_length+index_length) DESC;
Table 사용 용량 확인
SELECT
table_name, engine, table_rows AS tbl_rows,
avg_row_length AS rlen,
floor((data_length+index_length)/1024/1024) AS allmb, ,총용량
floor((data_length)/1024/1024) AS dmb, ,사용 용량
floor((index_length)/1024/1024) AS imb ,인덱스 용량
FROM
information_schema.tables
WHERE
table_schema=database()
ORDER BY
(data_length+index_length) DESC;
댓글