1、大表的数据多时,用alter语句去建立分区会非常慢,建议先 create table Tem like Origin; 然后在Tem表中引入分区;alter table Tem partition by range (column) (partition list...); 最后再修改表名;
2、表中数据量大时,若表中存在惟一索引会非常慢,联合索引、惟一索引和单一字段分别索引导入数据耗时如下试验:
mysql> insert into nkey select * from rdist;
Query OK, 2883741 rows affected (13.27 sec)
Records: 2883741 Duplicates: 0 Warnings: 0
mysql> insert into uqkey select * from rdist;
Query OK, 2883741 rows affected (1 min 42.78 sec)
Records: 2883741 Duplicates: 0 Warnings: 0
mysql> insert into mkey select * from rdist;
Query OK, 2883741 rows affected (30.53 sec)
Records: 2883741 Duplicates: 0 Warnings: 0