improving performance of mysql load data infile improving performance of mysql load data infile sql sql

improving performance of mysql load data infile


If you know the data is "clean", then you can drop indexes on the affected tables prior to the import and then re-add them after it is complete.

Otherwise, each record causes an index-recalc, and if you have a bunch of indexes, this can REALLY slow things down.


Its always hard to tell what is the cause of performance issues but these are my 2 cents:Your key being a uuid is randomly distributed which makes it hard to maintain an index. The reason being that keys are stored by range in a file system block, so having random uuids follow each other makes the OS read and write blocks to the file system without leveraging the cache. I don't know if you can change the key, but you could maybe sort the uuids in the input file and see if that helps. FYI, to understand this issue better I would take a look at this blog post and maybe read this book mysql high performance it has a nice chapter about innodb clustered index.Good Luck!