데이터베이스 InnoDB

InnoDB 파일 구조

  • 디스크 데이터 파일과 메모리 버퍼 풀 간에 한번에 전송되는 단위가 페이지(Pages)이다.
  • 페이지(Pages)의 기본 크기는 16KB이며 8KB또는 4KB로 변경도 가능함.
  • 페이지(Pages)는 레코드 다수의 행과 헤더 및 트레일러를 포함하고 있음.
  • 익스텐트(Extents)는 1MB 크기의 페이지 그룹이며 페이지 크기에 따라 페이지 갯수가 다름. (16KB이면 64개, 8KB이면 128개)
  • 세그먼트는 페이지들이 포함된 데이터 파일.
  • 테이블스페이스는 세그먼트 파일들이 존재하는 디렉토리 같은 개념.

innoDB 저장소 위치

show variables like ‘datadir’;

상태

SHOW ENGINE INNODB STATUS;

테이블 구조 확인

explain 테이블명;

또는

desc 테이블명;

innodb의 항목별 한계 값

https://dev.mysql.com/doc/refman/5.7/en/innodb-limits.html

데이터베이스 내 존재하는 테이블 상태

show table status from 데이터베이스명;

https://dev.mysql.com/doc/refman/5.7/en/innodb-persistent-stats.html#innodb-persistent-stats-tables

– size: 인덱스의 총 페이지 수 – n_leaf_pages: 인덱스의 리프 페이지 수 select database_name, table_name, index_name, stat_name, ROUND(stat_value * @@innodb_page_size / 1024 / 1024, 2) size_in_mb , stat_description from mysql.innodb_index_stats where database_name = ‘test’ and table_name = ‘test’ and stat_name in (‘size’, ‘n_leaf_pages’);

InnoDB INFORMATION_SCHEMA 시스템 테이블

https://dev.mysql.com/doc/refman/5.7/en/innodb-information-schema-system-tables.html

표준 InnoDB 모니터 활성화

https://dev.mysql.com/doc/refman/5.7/en/innodb-enabling-monitors.html

count 속도 개선

https://blog.naver.com/PostView.nhn?isHttpsRedirect=true&blogId=parkjy76&logNo=30098127917

index 관련

https://jojoldu.tistory.com/243