I have a data source on a Windows machine that supports an ODBC connection. I want to programmatically copy that entire data source to a MySql database every hour. Is there something faster than doing a select * from
and then doing an insert
for each row?
views:
88answers:
3
A:
Dont do the insert for each row. Each one takes extra time for the DB to respond that each row was successful. Instead, create batches of 100 inserts at a time with SQL transactions...
djangofan
2009-10-03 00:15:17
A:
The select * from
couldn't be avoided, as mentioned.
However, the inserts were two orders of magnitude faster than other methods if all the data was written to a file and LOAD DATA INFILE ...
was used.
The inserts were quick enough to cover the costs of writing ODBC data to a file and deleting the MySql data completely and starting from scratch.
Gautam
2009-10-18 19:01:19