sql - insert large volume of data in mysql -


i want insert atleast 500,000 fresh records in 1 shot. have used while loop inside procedure. query working fine taking alot of time execute. so, looking solution using can make process of insertion of large volume of data faster. have gone through many links didn't find them resourceful.

note:

  1. i want insert fresh data, not data existing table.
  2. syntactically code provided below correct , working. please not provide suggestions regarding syntax.

below procedure:

begin     declare x int;      declare start_s int;      declare end_s int;      set x = 0;       prepare stmt     'insert primary_packing(job_id, barcode, start_sn, end_sn, bundle_number, client_code, deno, number_sheets, number_pins, status) values (?,?,?,?,?,?,?,?,?,?)';      set @job_id = job_id, @barcode = barcode, @bundle_number = bundle_number, @client_code = client_code, @deno = deno, @number_sheets = number_sheets, @number_pins = number_pins, @status = 1;      set @start_sn = start_sn;     set @end_sn = end_sn;     while x <= multiply         set @start_s = (start_sn+(diff*x));          set @end_s = ((end_sn-1)+(diff*x)+diff);           execute stmt using @job_id, @barcode, @start_s, @end_s, @bundle_number, @client_code, @deno, @number_sheets, @number_pins ,@status;          set x = x + 1;      end while;      deallocate prepare stmt; end 

use mysql command load data infile load .csv files records specific table.

for more information , eg. please reffer following link

http://dev.mysql.com/doc/refman/5.1/en/load-data.html


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -