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:
- i want insert fresh data, not data existing table.
- 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
Comments
Post a Comment