--innodb和myisam存储引擎插入速度
------------------------------------2014/05/21
MySQL 5.6 全部默认设置,插入数据9999条,性能一般的虚拟机。
mysql> delete from test;
Query OK, 10000 rows affected (0.54 sec)
mysql> alter table test engine=myisam;
Query OK, 0 rows affected (0.15 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> call while_t();
Query OK, 1 row affected (1.55 sec)
mysql> select * from test order by id desc limit 10;
+------+------+
| id | name |
+------+------+
| 9999 | i |
| 9998 | i |
| 9997 | i |
| 9996 | i |
| 9995 | i |
| 9994 | i |
| 9993 | i |
| 9992 | i |
| 9991 | i |
| 9990 | i |
+------+------+
10 rows in set (0.02 sec)
mysql> delete from test;
Query OK, 10000 rows affected (0.02 sec)
mysql> alter table test engine=innodb;
Query OK, 0 rows affected (0.16 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> call while_t();
Query OK, 1 row affected (1 min 5.55 sec)
可以看到MyISAM使用时间1.55 sec,而innodb的使用1 min 5.55 sec,两者相差非常大。
当然这是在innodb全部参数都默认的情况下。
--待续