Some weeks back I helped a customer lower time to bulk-load data
into MySQL, they where at the time using a MySQL dumpfile
(containing SQL statements) to populate their tables during
nightly jobs.
By using LOAD DATA INFILE command and creating secondary
indexes after bulk-load of data load time went down by a factor
of almost 2x.
My test environment:
DB: MySQL 5.6.23
OS: Ubuntu 14.04
HW: My Toshiba Portege laptop with 2 cores and SSD disk
Commands/tables used in tests:
CREATE TABLE t1PK (i BIGINT UNSIGNED PRIMARY KEY, art
VARCHAR(32)) ENGINE=InnoDB; CREATE TABLE t1 (i BIGINT UNSIGNED PRIMARY KEY, art VARCHAR(32) UNIQUE KEY) ENGINE=InnoDB; LOAD DATA INFILE '/home/ted/labb/load-data/1000000' INTO TABLE test.t1 FIELDS TERMINATED BY ','; |
I created a file …