[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;
번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|---|
909 | System/OS | [router] 시스코 라우터 명령어 모드.. | hooni | 2013.04.23 | 12946 |
908 | Algorithm | [security] 블럭 암호에 대해서.. | hooni | 2013.04.23 | 17121 |
907 | System/OS | [router] 라우팅 프로토콜 BGP (간단한 세팅) | hooni | 2013.04.23 | 10951 |
906 | System/OS | 네트워크별 MTU(최대 전송 단위) | hooni | 2013.04.23 | 17643 |
905 | System/OS | OSI (Open Systems Interconnection) 개방형 시스템간 상호 접속 | hooni | 2013.04.23 | 10787 |
904 | System/OS | 라우팅 경로 결정 영향 요소 ㅋㅋ | hooni | 2013.04.23 | 15852 |
903 | System/OS | [owasp] 10대 웹어플리케이션 보안 취약 | hooni | 2013.04.23 | 15908 |
902 | Database | [mysql] 루트 암호 초기화 | hooni | 2013.04.23 | 11046 |
901 | Algorithm | Polynomial time 이란? ㅋㅋ | hooni | 2013.04.23 | 22692 |
900 | System/OS | [linux] /etc/fstab 설정 방법.. ㅋㅋ | hooni | 2013.04.23 | 12084 |
899 | Algorithm | 암호 알고리즘 및 프로토콜의 이해.. | hooni | 2013.04.23 | 17213 |
898 | Develop | [js] One Time Pad key generatorㅡ.,ㅡ; | hooni | 2013.04.23 | 6792 |