-
DB크기 검색프로그램/Mysql 2016. 9. 7. 10:00반응형
[ DB크기 검색 ]
-- 테이블 용량 체크
SELECT COUNT(*) TABLES,
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;
-- 가장 큰 DB 찾기
SELECT
COUNT(*) TABLES,
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;
출처 : http://365.hostway.co.kr/101
반응형'프로그램 > Mysql' 카테고리의 다른 글
My-SQL 조인관련 이것저것 (1) 2024.01.23 My-SQL 함수 모음 (1) 2024.01.23 My-SQL 함수 및 잡다 (0) 2024.01.23 mysql에서 utf-8인 경우 한글 2바이트 계산 (0) 2016.09.07