━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

MyISAM          MySQLの基本となるタイプ。テーブル単位のロック
BDB(BerkeleyDB) トランザクション,ページ単位のロックが可能
InnoDB        トランザクション,行単位のロック,外部キーが可能

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

CREATE TABLE `DB01`.`TABLE007` (
`id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`comment` VARCHAR(45) NOT NULL,
PRIMARY KEY (`id`)
)
ENGINE = MyISAM;

mysql> show create table DB01.TABLE007 \G
*************************** 1. row ***************************
Table: TABLE007
Create Table: CREATE TABLE `TABLE007` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`comment` varchar(45) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8
1 row in set (0.00 sec)
mysql>

mysql> show table status like ‘TABLE007’\G
*************************** 1. row ***************************
Name: TABLE007
Engine: MyISAM
Version: 10
Row_format: Dynamic
Rows: 3
Avg_row_length: 24
Data_length: 72
Max_data_length: 281474976710655
Index_length: 2048
Data_free: 0
Auto_increment: 4
Create_time: 2009-02-03 10:23:48
Update_time: 2009-02-03 10:28:37
Check_time: NULL
Collation: utf8_general_ci
Checksum: NULL
Create_options:
Comment:
1 row in set (0.13 sec)

mysql>

mysql> ALTER TABLE TABLE007 ENGINE = InnoDB;
Query OK, 3 rows affected (0.01 sec)
Records: 3  Duplicates: 0  Warnings: 0
TABLEがINNODBに変換されていることを確認出来ます。
mysql> show table status like ‘TABLE007’\G
*************************** 1. row *******************
Name: TABLE007
Engine: InnoDB
Version: 10
Row_format: Compact
Rows: 3
Avg_row_length: 5461
Data_length: 16384
Max_data_length: 0
Index_length: 0
Data_free: 4194304
Auto_increment: 4
Create_time: 2009-02-03 10:34:22
Update_time: NULL
Check_time: NULL
Collation: utf8_general_ci
Checksum: NULL
Create_options:
Comment:
1 row in set (0.12 sec)

mysql>

mysql> select table_name,engine from INFORMATION_SCHEMA.TABLES where TABLE_NAME
=’TABLE007’;
+————+——–+
| table_name | engine |
+————+——–+
| TABLE007 | InnoDB |
+————+——–+
1 row in set (0.26 sec)

mysql>

MYISAM

MYISAM



INNODB

INNODB


Comments are closed.

Post Navigation