I'm trying to speed up Load Data Infile and after some experimenting have noticed this "qwirk".

BTW, all of the tables used below are empty and have identical table structures. The value being loaded into the primary key column is 'NULL'.

Test1:
246 seconds to run Load Data Infile into a table (Table1) with 1 primary autoinc column, and 2 compound keys.

Test2:
 69 seconds to  run Load Data Infile into similar table (Table2) with no keys
111 seconds to rebuild the missing keys in Table2

69+111=180 seconds for Table2 compared to 246 seconds for Table1.

Now I thought when using Load Data Infile on an empty table it would rebuild *all* of the keys AFTER the data has been loaded. This may not be the case. I suspect the extra time for Test1 is caused by the Load Data building the primary key as the data is being loaded.

Can someone confirm this?
If so, then when loading data into an empty table, it is always going to be faster to remove the keys then load the data, then add the keys.

Mike


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=arch...@jab.org

Reply via email to