简体   繁体   中英

Create MySQL InnoDB dumps with bulk inserts?

I need to speed up the import of a sql.gz file into mysql. I have turned off foreign key checking and followed this page .

My question is:

Is there a way to make the export file (the sql.gz) from mysqldump user multi-insert statements like this:

INSERT INTO yourtable 
VALUES (1,2), (5,5), ...;

so that the bulk loading process will be much faster?

mysqldump does this by default. There are many other options (such as use REPLACE or INSERT IGNORE as opposed to the default INSERT command) run mysqldump --help to see the list.

You might try LOAD DATA INFILE to see if that is faster. That will read the data from a tab delimited text file without any INSERT commands. You would use SELECT ... INTO OUTFILE 'file_name' as one way to create this data file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM