插入50万条数据的时间简单比较。三个表song,song2,song3的字段一致。
mysql> desc song\G *************************** 1. row *************************** Field: id Type: int(11) Null: NO Key: PRI Default: NULL Extra: auto_increment *************************** 2. row *************************** Field: name Type: text Null: NO Key: Default: Extra: *************************** 3. row *************************** Field: datetime Type: timestamp Null: NO Key: Default: CURRENT_TIMESTAMP Extra: *************************** 4. row *************************** Field: rank Type: int(11) Null: NO Key: Default: Extra: 4 rows in set (0.00 sec) mysql> Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 6.0.0-alpha-community-nt-debug MySQL Community Server (GPL) Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql>
call sp_insert_mod(500000); Query OK, 0 rows affected (
1 min 7.27 sec)
mysql>
call sp_insert_mod2(500000); Query OK, 0 rows affected (
1 min 19.81 sec)
mysql>
call sp_insert_mod3(500000); Query OK, 0 rows affected (
1 min 33.17 sec)
mysql>
select count(*) from song; +----------+
| count(*) |
+----------+
| 500000 |
+----------+
1 row in set (
0.02 sec)
mysql>
select count(*) from song2; +----------+
| count(*) |
+----------+
| 500000 |
+----------+
1 row in set (
0.92 sec)
mysql>
select count(*) from song3; +----------+
| count(*) |
+----------+
| 500000 |
+----------+
1 row in set (
2.61 sec)
mysql>exit
Bye
当然你可以对MyISAM表使用MRG_MYISAM引擎来调高速度,
对INNODB表使用PARTITION 来提高速度。
本文出自 “” 博客,转载请与作者联系!