MYSQL Insert Huge SQL Files of GB in Size

耗尽温柔 提交于 2019-12-03 21:01:54
Attila Szlovencsák

Since you have less than 50GB of memory (so you can't buffer the entire database in memory), the bottleneck is the write speed of your disk subsystem.

Tricks to speed up imports:

  • MyISAM is not transactional, so much faster in single threaded inserts. Try to load into MyISAM, then ALTER the table to INNODB
    • Use ALTER TABLE .. DISABLE KEYS to avoid index updates line by line (MyISAM only)
    • Set bulk_insert_buffer_size above your insert size (MyISAM only)
    • Set unique_checks = 0 so that unique constrains are not checked.

For more, see Bulk Data Loading for InnoDB Tables in MySQL Manual.

Note: If the original table have foreign key constraints, using MyISAM as an intermediate format is a bad idea.

Use MyISAM, usually much faster than InnoDB, if your data base isnt transaction oriented. Did you research into using any table partitioning/sharding techniques?

Converting huge MyISAM into InnoDB will again run into performance issues, so I am not sure I would do that. But disabling and re-enabling keys could be of help...

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!