我试过mysql控制台:
source filename
花了太长时间(我认为总行数约为2100万)。在调查了一下之后我发现了this,所以我尝试了:
set autocommit=0;
set unique_checks=0;
set foreign_key_checks=0;
source filename
它还需要太长时间!
Query OK, 11437 rows affected (0.44 sec)
Records: 11437 Duplicates: 0 Warnings: 0
Query OK, 11369 rows affected (0.59 sec)
Records: 11369 Duplicates: 0 Warnings: 0
Query OK, 12282 rows affected (0.44 sec)
Records: 12282 Duplicates: 0 Warnings: 0
Query OK, 12267 rows affected (0.60 sec)
Records: 12267 Duplicates: 0 Warnings: 0
Query OK, 12259 rows affected (4.01 sec)
Records: 12259 Duplicates: 0 Warnings: 0
Query OK, 12285 rows affected (21.36 sec)
Records: 12285 Duplicates: 0 Warnings: 0
Query OK, 12262 rows affected (20.50 sec)
Records: 12262 Duplicates: 0 Warnings: 0
(... after ~20 minutes ...)
Query OK, 11995 rows affected (49.61 sec)
Records: 11995 Duplicates: 0 Warnings: 0
Query OK, 11987 rows affected (36.57 sec)
Records: 11987 Duplicates: 0 Warnings: 0
Query OK, 11996 rows affected (1 min 3.62 sec)
Records: 11996 Duplicates: 0 Warnings: 0
Query OK, 11982 rows affected (31.21 sec)
Records: 11982 Duplicates: 0 Warnings: 0
Query OK, 11984 rows affected (1 min 5.15 sec)
Records: 11984 Duplicates: 0 Warnings: 0
关闭独特的外键检查不应发生这种性能随着音量的衰减。那么,我错过了什么?