Insert million rows | SoloLearn: Learn to code for FREE!

+13

Insert million rows

how to insert million rows into a table at a time(stored procedure?)?

2/4/2017 2:27:21 AM

siddiq shameer

4 Answers

New Answer

+3

Check 'load data infile': https://dev.mysql.com/doc/refman/5.7/en/load-data.html

+2

Does your data come from a file or a table? You can do BULK INSERT to write all your data from a csv file for example to a staging table. This is only one line of code. However, you will have to define your staging table's columns to match the exact columns of your csv file. Once the data is imported to a table, this can be a table variable or a temp table and then you can insert the data into your designated table using this example command: insert into your_table name select * from staging_table. This will copy all rows in the staging table to the new table and then you may need to truncate or drop the staging table. Hope that helps, thanks.

+1

i was making rainbow tables for my hashing algorithm and i stopped after 42,000

0

search for bulk insert