0

I am using the code below to insert a 2.2MB file into a MySQL database in the cloud using Azure (the free version) with 36 thousand rows and 8 columns of doubles.

MySqlCommand sqlCmd = new MySqlCommand(
    "LOAD DATAINFILE 'Data4.csv'            
    INTO TABLE ljmuracing.record 
    FIELDS TERMINATED BY ',';", mConnection);
sqlCmd.ExecuteNonQuery();
mConnection.Close();

The problem is that it's extremely slow; about 2 thousand rows uploaded every 5 minutes. Sometimes, the connection times out.

How can I speed this up? Am I doing something extremely inefficient?

My upload speed as of now is 14 MB/s, so I don't think it is that.

  • What is the structure of the table you are importing the data into? – Tero Kilkanen Mar 20 '16 at 17:04
  • Where is MySQL being hosted: Your own VM? Part of a 3rd-party offering? – David Makogon Mar 20 '16 at 19:47
  • you may try load data concurrent infile to speed it up as it opens parallel threads – Nawaz Sohail Mar 22 '16 at 11:25
  • DATAINFILE needs a space in it. – Rick James Mar 22 '16 at 23:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy