myisam和innodb的插入性能
时间:2009-08-17 来源:cenalulu
自己做的小测试:
测试表结构crc,word
+-------+------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+------------------+------+-----+---------+-------+
| word | varchar(50) | YES | MUL | NULL | |
| crc | int(10) unsigned | YES | MUL | NULL | |
+-------+------------------+------+-----+---------+-------+
+---------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment |
+---------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| crctest | 1 | crcidx | 1 | crc | A | 479829 | NULL | NULL | YES | BTREE | |
| crctest | 1 | wordidx | 1 | word | A | 479829 | 10 | NULL | YES | BTREE | |
+---------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
myisam直接插入: 3.83s
myisam插入+enable keys: 0.64+3.26s=3.90s
innodb直接插入: 50.69s
myisam插入+create keys: 4.55+45.58+60.82s = 110.95s
测试表结构crc,word
+-------+------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+------------------+------+-----+---------+-------+
| word | varchar(50) | YES | MUL | NULL | |
| crc | int(10) unsigned | YES | MUL | NULL | |
+-------+------------------+------+-----+---------+-------+
+---------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment |
+---------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| crctest | 1 | crcidx | 1 | crc | A | 479829 | NULL | NULL | YES | BTREE | |
| crctest | 1 | wordidx | 1 | word | A | 479829 | 10 | NULL | YES | BTREE | |
+---------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
myisam直接插入: 3.83s
myisam插入+enable keys: 0.64+3.26s=3.90s
innodb直接插入: 50.69s
myisam插入+create keys: 4.55+45.58+60.82s = 110.95s
相关阅读 更多 +