개발/DB

[DB] 테이블별 사이즈/용량(mb) 조회 쿼리

라보떼 2019. 1. 9. 16:44

데이터베이스 테이블별로 각 rows 와 용량을 조회하기 위한 쿼리 입니다.



1
2
3
4
5
6
7
8
9
10
SELECT 
    table_name,
    table_rows,
    round(data_length/(1024*1024),2) as 'DATA_SIZE(MB)',
    round(index_length/(1024*1024),2) as 'INDEX_SIZE(MB)'
FROM information_schema.TABLES
where table_schema = '데이터베이스이름'
GROUP BY table_name 
ORDER BY data_length DESC 
LIMIT 10;
cs