MySQL 테이블의 엔진 타입은 어떻게 확인하나요?
💡 요약 정리
- MySQL 테이블의 엔진 타입은
show table status명령어나information_schema조회를 통해 확인할 수 있습니다. - 엔진 타입은 MyISAM, InnoDB 등으로 구분되며, 테이블마다 다르게 설정될 수 있습니다.
- 쿼리 실행 전 사용 중인 데이터베이스를 먼저 선택해야 합니다.
1. show table status 명령어로 확인
MySQL에 접속한 후, 확인하려는 데이터베이스로 이동해 아래 쿼리를 실행하면 각 테이블의 엔진 타입을 알 수 있습니다.
mysql> use mysql;
Database changed
mysql> show table status;
+---------------------------+--------+---------+------------+------+----------------+-------------+--------------------+--------------+-----------+----------------+---------------------+---------------------+---------------------+-----------------+----------+----------------+---------------------------------------------------+
| Name | Engine | Version | Row_format | Rows | Avg_row_length | Data_length | Max_data_length | Index_length | Data_free | Auto_increment | Create_time | Update_time | Check_time | Collation | Checksum | Create_options | Comment |
+---------------------------+--------+---------+------------+------+----------------+-------------+--------------------+--------------+-----------+----------------+---------------------+---------------------+---------------------+-----------------+----------+----------------+---------------------------------------------------+
| columns_priv | MyISAM | 10 | Fixed | 0 | 0 | 0 | 227994731135631359 | 1024 | 0 | NULL | 2012-12-14 16:03:31 | 2012-12-14 16:03:31 | NULL | utf8_bin | NULL | | Column privileges |
| db | MyISAM | 10 | Fixed | 3 | 438 | 1314 | 123286039799267327 | 4096 | 0 | NULL | 2012-12-14 16:03:31 | 2012-12-14 16:03:31 | NULL | utf8_bin | NULL | | Database privileges |
| func | MyISAM | 10 | Fixed | 0 | 0 | 0 | 162974011515469823 | 1024 | 0 | NULL | 2012-12-14 16:03:31 | 2012-12-14 16:03:31 | NULL | utf8_bin | NULL | | User defined functions |
| help_category | MyISAM | 10 | Fixed | 36 | 581 | 20916 | 163536961468891135 | 3072 | 0 | NULL | 2008-12-11 13:47:24 | 2012-12-14 17:09:34 | 2012-12-14 16:03:05 | utf8_general_ci | NULL | | help categories |
... (이하 생략)
17 rows in set (0.01 sec)
mysql>
2. information_schema 테이블에서 확인
다른 방법으로는 information_schema 데이터베이스의 tables 테이블을 이용하여 확인하는 것입니다.
mysql> select table_schema,table_name,engine from information_schema.tables where table_schema='mysql';
+--------------+---------------------------+--------+
| table_schema | table_name | engine |
+--------------+---------------------------+--------+
| mysql | columns_priv | MyISAM |
| mysql | db | MyISAM |
| mysql | func | MyISAM |
| mysql | help_category | MyISAM |
| mysql | help_keyword | MyISAM |
| mysql | help_relation | MyISAM |
| mysql | help_topic | MyISAM |
| mysql | host | MyISAM |
| mysql | proc | MyISAM |
| mysql | procs_priv | MyISAM |
| mysql | tables_priv | MyISAM |
| mysql | time_zone | MyISAM |
| mysql | time_zone_leap_second | MyISAM |
| mysql | time_zone_name | MyISAM |
| mysql | time_zone_transition | MyISAM |
| mysql | time_zone_transition_type | MyISAM |
| mysql | user | MyISAM |
+--------------+---------------------------+--------+
17 rows in set (0.01 sec)
mysql>