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

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

조회 수 6201 추천 수 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. CMT를 이용하여 원본 특정 테이블의 일부 데이터만 가져와 대상 테이블에 넣기

    Date2016.01.28 Category마이그레이션 By엄기호 Views4556
    Read More
  2. MySQL 테이블 크기 조사하기-공유

    Date2015.12.31 Category마이그레이션 By주현 Views6201
    Read More
  3. CUBRID와 Oracle의 NULL과 '' (empty string)의 처리 차이점

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

    Date2015.12.28 Category마이그레이션 By권호일 Views6329
    Read More
  5. CUBRID vs MySQL vs ORACLE SQL 타입별 비교

    Date2013.07.12 Category마이그레이션 By정만영 Views69142
    Read More
  6. MySQL+XE를 CUBRID+XE로 운영하기 – mysqldump파일과 CMT사용

    Date2012.11.13 Category마이그레이션 Bycubebridge Views23070
    Read More
  7. MySQL에서 CUBRID로 갈아탈 때 알아야 할 것

    Date2012.11.13 Category마이그레이션 Bycubebridge Views22611
    Read More
  8. 오라클의 order by 시 first와 last 대체 사용법

    Date2012.11.12 Category마이그레이션 Bycubebridge Views20572
    Read More
  9. CUBRID Migration Tookit 8.4.1

    Date2012.04.14 Category마이그레이션 Bycubebridge Views11081
    Read More
  10. 데이터베이스 마이그레이션(unloaddb & loaddb) 의 효과적인 수행방법

    Date2012.04.14 Category마이그레이션 Bycubebridge Views24544
    Read More
  11. MySQL에서 사용하는 스키마 변환시 주의 사항

    Date2012.03.02 Category마이그레이션 By정만영 Views13253
    Read More
  12. 오라클 to CUBRID로 마이그레이션 수행 시 주의사항

    Date2012.03.02 Category마이그레이션 By정만영 Views21057
    Read More
  13. 타 DBMS를 CUBRID로 마이그레이션 시 varchar,char 컬럼 사이즈 관련

    Date2010.07.01 Category마이그레이션 By손승일 Views38023
    Read More
  14. 타 DB 에서 마이그레이션시 질의 변경 샘플 - CASE 문

    Date2009.12.31 Category마이그레이션 By웁쓰 Views21923
    Read More
  15. CUBRID는 MySQL의 varchar(255)와 동일한 길이가 아닌가요?

    Date2009.12.28 Category마이그레이션 By손승일 Views27789
    Read More
  16. CUBRID 하위버젼에서 CUBRID2008로의 업그레이드 방법

    Date2008.12.06 Category마이그레이션 By남재우 Views30154
    Read More
  17. MySQL의 limit 명령어 처리

    Date2008.11.21 Category마이그레이션 Byadmin Views32683
    Read More
Board Pagination Prev 1 Next
/ 1

Contact Cubrid

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