0

I have a CSV file that contains a lot of integer values. Is it better to insert these individual values in bulk as in a full transaction or should I be inserting the CSV file itself into the MySQL?

  • 1
    What are you going to do with the data after it is in the database? That would probably help give some perspective that would help with answers. – Mark Wilkins Mar 15 '13 at 22:51
1

Insert the individual values in bulk. In other words, each row of the csv file should become a row in the database with the same number of columns.

Using Notepad++ you can use a regex find and replace to easily convert your CSV into a very large insert statement. Replace \r\n with '),(' and , with ','. Tidy up the first and last line of the file, then add the actual insert statement to the front. insert into table (col1, col2, col3) values .....

Your Answer

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