Best practices for importing large CSV files

前端 未结 10 863
攒了一身酷
攒了一身酷 2020-12-14 16:39

My company gets a set of CSV files full of bank account info each month that I need to import into a database. Some of these files can be pretty big. For example, one is abo

10条回答
  •  旧时难觅i
    2020-12-14 17:03

    FWIW the following steps caused a huge speedup of my LOAD DATA INFILE:

    SET FOREIGN_KEY_CHECKS = 0;
    SET UNIQUE_CHECKS = 0;
    SET SESSION tx_isolation='READ-UNCOMMITTED';
    SET sql_log_bin = 0;
    #LOAD DATA LOCAL INFILE....
    SET UNIQUE_CHECKS = 1;
    SET FOREIGN_KEY_CHECKS = 1;
    SET SESSION tx_isolation='READ-REPEATABLE';
    

    See article here

提交回复
热议问题