티스토리 뷰

기술

[MySQL] Database별 Size 확인 Query

퍼렁별여행자 2014. 7. 18. 17:55

Database별 Size 확인 Query

SELECT

count(*) NUM_OF_TABLE,

table_schema,concat(round(sum(table_rows)/1000000,2),'M') rows,

concat(round(sum(data_length)/(1024*1024*1024),2),'G') DATA,

concat(round(sum(index_length)/(1024*1024*1024),2),'G') idx,

concat(round(sum(data_length+index_length)/(1024*1024*1024),2),'G') total_size,

round(sum(index_length)/sum(data_length),2) idxfrac

FROM information_schema.TABLES

GROUP BY table_schema

ORDER BY sum(data_length+index_length) DESC LIMIT 10;


파일시스템 용량부족의 압박이 있어, 대체 어떤 Database가 많이 사용하고 있는지 확인하려고 참조한 Query

댓글
공지사항
퍼렁별여행자
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함
링크