テーブルごとに指定できるストレージエンジンの一覧を表示する方法を記します。
show table statusでストレージエンジン一覧を表示することができます。
以下にデータベースを作成しInnoDB, MyISAMのテーブルを1つずつ、合計2テーブルを作成しshow table statusコマンドを使用した結果を記します。
$ mysql -u root -p -s Enter password: mysql> create database db1; mysql> use db1 mysql> create table t1 (a int, b int) engine innodb; mysql> create table t2 (a int, b int) engine myisam;
mysql> use db1 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 t1 InnoDB 10 Compact 0 0 16384 0 0 4194304 NULL 2012-10-01 16:57:19 NULL NULL utf8_general_ci NULL t2 MyISAM 10 Fixed 0 0 0 2533274790395903 1024 0 NULL 2012-10-01 16:57:27 2012-10-01 16:57:27 NULL utf8_general_ci NULL
テーブルの各種情報が表示されEngineの部分を見ればストレージエンジンを特定することができます。
しかしこれでは見にくいので\Gを使用して縦表示にしてみます。
縦に表示(\G)により少し見やすくなりました。
mysql> show table status \G
*************************** 1. row ***************************
Name: t1
Engine: InnoDB
Version: 10
Row_format: Compact
Rows: 0
Avg_row_length: 0
Data_length: 16384
Max_data_length: 0
Index_length: 0
Data_free: 4194304
Auto_increment: NULL
Create_time: 2012-10-01 16:57:19
Update_time: NULL
Check_time: NULL
Collation: utf8_general_ci
Checksum: NULL
Create_options:
Comment:
*************************** 2. row ***************************
Name: t2
Engine: MyISAM
Version: 10
Row_format: Fixed
Rows: 0
Avg_row_length: 0
Data_length: 0
Max_data_length: 2533274790395903
Index_length: 1024
Data_free: 0
Auto_increment: NULL
Create_time: 2012-10-01 16:57:27
Update_time: 2012-10-01 16:57:27
Check_time: NULL
Collation: utf8_general_ci
Checksum: NULL
Create_options:
Comment:
この方法がストレージエンジンを調べるときに一番見やすいと思います。
select table_name, engine from information_schema.tables where table_schema = 'データベース名';
mysql> select table_name, engine from information_schema.tables where table_schema = 'db1'; +------------+--------+ | table_name | engine | +------------+--------+ | t1 | InnoDB | | t2 | MyISAM | +------------+--------+ 2 rows in set (0.00 sec)