Bug #27152 | LOAD DATA INFILE slower when inserting successive datasets | ||
---|---|---|---|
Submitted: | 14 Mar 2007 19:18 | Modified: | 28 Mar 2007 11:21 |
Reporter: | Guillaume Lefranc | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: MyISAM storage engine | Severity: | S5 (Performance) |
Version: | 5.0.32-log | OS: | Linux (Ubuntu 6.06 LTS x86_64) |
Assigned to: | CPU Architecture: | Any |
[14 Mar 2007 19:18]
Guillaume Lefranc
[28 Mar 2007 10:43]
MySQL Verification Team
Hello Guillaume, This is expected behaviour that LOAD DATA into empty MyISAM table is faster then loading the same data into non-empty table. This is quote from our manual: LOAD DATA INFILE performs the preceding optimization automatically if the MyISAM table into which you insert data is empty. The main difference between automatic optimization and using the procedure explicitly is that you can let myisamchk allocate much more temporary memory for the index creation than you might want the server to allocate for index re-creation when it executes the LOAD DATA INFILE statement. http://dev.mysql.com/doc/refman/5.0/en/insert-speed.html So to speed up load you should disable keys, then load data and enable keys again.
[28 Mar 2007 11:21]
Guillaume Lefranc
Thanks for your answer, I was partially aware of this behaviour. My suggestion was that (enable/disable keys) should be used by default.
[28 Mar 2007 18:50]
Sergei Golubchik
It cannot be used by default, because this optimization only helps when you add many rows to the table. If the table is already quite big, and LOAD DATA adds only a small fraction of the existing table size then disabling/enabling keys would make the load slower, not faster.