<참조> https://ryean.tistory.com/21
전체, 데이터베이스별, 테이블 용량 확인 쿼리
1. 전체 용량 조회
SELECT ROUND(SUM(data_length+index_length)/1024/1024, 1) AS 'Used(MB)',
ROUND(SUM(data_free)/1024/1024, 1) AS 'Free(MB)'
FROM information_schema.tables;
2. 데이터베이스별 용량 조회
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;
3. 테이블별 용량 (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;
'DBMS, 데이터베이스' 카테고리의 다른 글
[mysql] 테이블 스키마 정보 조회 (0) | 2022.06.16 |
---|---|
DB 관리툴 - dbeaver 설치 및 사용(윈도우 10) (0) | 2022.06.16 |
커밋(commit)한 Insert, Update, Delete 쿼리 취소 (0) | 2022.06.08 |
데이터베이스 마이그레이션 이야기 4 (MySQL to MySQL) (0) | 2022.06.08 |
TODO List 테이블 생성과 CRUD, MySQL 쿼리 예제 (0) | 2022.06.07 |