Background Image
마이그레이션
2015.12.31 20:59

MySQL 테이블 크기 조사하기-공유

조회 수 6203 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄


MySQL에서 CUBRID로 전환 시, DB용량 산정에 유익하여 해당 내용을 공유합니다.


참조 : http://www.mysqlperformanceblog.com/2008/03/17/researching-your-mysql-table-sizes/


MySQL 서버에서 인덱스 크기에서 테이블의 개수 , 컬럼, 전체 데이타의 크기


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;
+--------+--------+-------+-------+------------+---------+
| TABLES | rows   | DATA  | idx   | total_size | idxfrac |
+--------+--------+-------+-------+------------+---------+
|    501 | 30.54M | 8.47G | 5.06G | 13.53G     |    0.60 | 
+--------+--------+-------+-------+------------+---------+
1 row in set (46.07 sec)




가장 큰 데이타베이스 찾기

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;
+--------+--------------------+--------+-------+-------+------------+---------+
| TABLES | table_schema       | rows   | DATA  | idx   | total_size | idxfrac |
+--------+--------------------+--------+-------+-------+------------+---------+
|    369 | advanced2          | 26.73M | 5.74G | 5.03G | 10.77G     |    0.88 | 
|     17 | james_2            | 2.29M  | 1.71G | 0.01G | 1.72G      |    0.01 | 
|     17 | james_1            | 2.32M  | 0.81G | 0.01G | 0.82G      |    0.02 | 
|     17 | james_3            | 0.00M  | 0.15G | 0.00G | 0.15G      |    0.00 | 
|      7 | agent              | 0.02M  | 0.08G | 0.00G | 0.08G      |    0.00 | 
|      1 | test               | 0.08M  | 0.00G | 0.00G | 0.00G      |    0.00 | 
|     30 | tracker3           | 0.00M  | 0.00G | 0.00G | 0.00G      |    0.33 | 
|     17 | james_5            | 0.00M  | 0.00G | 0.00G | 0.00G      |    0.04 | 
|      9 | james_4            | 0.00M  | 0.00G | 0.00G | 0.00G      |    0.02 | 
|     17 | information_schema | NULL   | 0.00G | 0.00G | 0.00G      |    NULL | 
+--------+--------------------+--------+-------+-------+------------+---------+
10 rows in set (5.52 sec)



저장엔진별로 보기


SELECT engine,
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
GROUP BY engine
ORDER BY sum(data_length+index_length) DESC LIMIT 10;
+-----------+--------+--------+-------+-------+------------+---------+
| engine    | TABLES | rows   | DATA  | idx   | total_size | idxfrac |
+-----------+--------+--------+-------+-------+------------+---------+
| InnoDB    |    406 | 26.81M | 6.11G | 5.00G | 11.12G     |    0.82 | 
| MyISAM    |     76 | 2.45M  | 2.32G | 0.06G | 2.38G      |    0.02 | 
| FEDERATED |      6 | 0.02M  | 0.09G | 0.00G | 0.09G      |    0.00 | 
| MEMORY    |     13 | NULL   | 0.00G | 0.00G | 0.00G      |    NULL | 
+-----------+--------+--------+-------+-------+------------+---------+
4 rows in set (11.90 sec)


  1. MySQL 테이블 크기 조사하기-공유

    Date2015.12.31 Category마이그레이션 By주현 Views6203
    Read More
  2. CUBRID BACKUP (linux, window)

    Date2015.12.30 Category운영관리 By박동윤 Views6244
    Read More
  3. Cubrid는 어떤 쿼리를 동일한 쿼리로 판단할까?

    Date2015.12.30 Category질의작성 By이상신 Views4010
    Read More
  4. 브로커와 DB 간 연결 테스트

    Date2015.12.29 Category운영관리 By박동윤 Views4934
    Read More
  5. CUBRID HA 제약 사항 및 확인 방법

    Date2015.12.29 Category응용개발 By손승일 Views5304
    Read More
  6. cubrid plandump ( plan cache정보확인)

    Date2015.12.29 Category운영관리 By주현 Views4300
    Read More
  7. CUBRID와 Oracle의 NULL과 '' (empty string)의 처리 차이점

    Date2015.12.29 Category마이그레이션 By권호일 Views15418
    Read More
  8. CM(CUBRID Manager)을 이용하여 행정표준코드시스템의 기관코드 가져오기

    Date2015.12.28 Category마이그레이션 By권호일 Views6329
    Read More
  9. 테이블 명세서 한 시트로 합치기

    Date2015.12.24 CategoryCUBRID 매니저 By성진 Views16523
    Read More
  10. 일정 범위 임의의 정수 생성 방법(random 함수 응용)

    Date2015.12.22 Category질의작성 By손승일 Views6472
    Read More
  11. 시스템 부하가 많지 않음에도 불구하고 질의 수행이 느린 경우 THP 기능 설정 확인 및 해제

    Date2015.12.16 Category운영관리 By진우진 Views7526
    Read More
  12. 큐브리드 서비스 재구동 시 cubrid manager server start: fail 오류 해결 방법

    Date2015.12.16 Category운영관리 By진우진 Views7731
    Read More
  13. maven에서 CUBRID JDBC Driver 추가하기

    Date2015.12.09 Category응용개발 By김승훈 Views8935
    Read More
  14. 오라클의 DBMS_RANDOM.STRING() 함수를 CUBRID 식으로 구현하는 방법

    Date2015.12.08 Category질의작성 By이경오 Views7973
    Read More
  15. 테이블 용량 산정 쿼리

    Date2015.12.08 Category질의작성 By성진 Views7398
    Read More
  16. WHERE 조건에서 다중 컬럼 IN절 처리 최적화 방법 (cubrid + ibatis)

    Date2015.08.21 Category응용개발 By이상신 Views55133
    Read More
  17. 브로커 동적 파라미터 변경 방법

    Date2015.08.13 Category운영관리 By정만영 Views7566
    Read More
  18. 전체 테이블 UPDATE시 SELECT, UPDATE를 통한 INDEX SCAN방식으로 테이블 X_LOCK을 방지하자!

    Date2015.08.13 Category질의작성 By이경오 Views13794
    Read More
  19. CUBRID HA 구성 후 구동중인 slave/replica node에서 write 하기

    Date2015.07.15 Category운영관리 By정만영 Views9043
    Read More
  20. INSERT수행 시, 현재날짜,현재시각으로 자동 입력하는 방법

    Date2015.07.08 Category질의작성 By주현 Views25201
    Read More
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 14 Next
/ 14

Contact Cubrid

대표전화 070-4077-2110 / 기술문의 070-4077-2113 / 영업문의 070-4077-2112 / Email. contact_at_cubrid.com
Contact Sales