[mysql] MySql DB/테이블 사이즈 확인을 위한 쿼리
1. 테이블별 사이즈 확인 (쿼리 시점에 정확한 사이즈는 아니지만, 참고할 만한 데이터임)
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;
2. Database 별 사이즈 확인 (쿼리 시점에 정확한 사이즈는 아니지만, 참고할 만한 데이터임)
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;
번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|---|
9 | Algorithm | OCB5 Injection 앗싸뵹! ㅋㅋ | hooni | 2014.07.01 | 774 |
8 | Algorithm | 러시아 페인트공 알고리즘에 대해.. | hooni | 2013.04.23 | 22877 |
7 | Algorithm | 디피헬만(Diffie-Hellman) 초간단 개념.. | hooni | 2013.04.23 | 81003 |
6 | Algorithm | 암호 알고리즘 및 프로토콜의 이해.. | hooni | 2013.04.23 | 17191 |
5 | Algorithm | Polynomial time 이란? ㅋㅋ | hooni | 2013.04.23 | 22214 |
4 | Algorithm | [security] 블럭 암호에 대해서.. | hooni | 2013.04.23 | 17101 |
3 | Algorithm | 스터디 자료, 암호화에 대해서.. 나중에 볼 ppt.. | hooni | 2013.04.23 | 13328 |
2 | Algorithm | [security] RSA 암호화 설명과 예.. | hooni | 2013.04.23 | 16599 |
1 | Algorithm | [algorithm] Greedy (탐욕 기법) | hooni | 2003.04.23 | 15095 |