How to speed up a data loading into InnoDB (LOAD DATA INFILE)?

前端 未结 5 2109
粉色の甜心
粉色の甜心 2020-12-24 09:37

I want to speed up a data loading.

I use MySQL 5.5, InnoDB and have 1M rows of data (65Mb file). It takes 5 minutes.

What mysql settings and commands affect

5条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-24 10:22

    I can recommend these settings to improve load time:

    • innodb_doublewrite = 0
    • innodb_support_xa = 0
    • innodb_buffer_pool_size = (50-80% of system memory)
    • innodb_log_file_size = (a large number - 256M etc)
    • innodb_flush_log_at_trx_commit = 0

    Other than settings, there are some things you can do yourself:

    • Create indexes after loading (this is a new optimization with 5.5 / InnoDB plugin).
    • Sort the data file before loading.
    • Split the data file, and load in parallel.

提交回复
热议问题