Submit PHP form with 6000 rows data -
actually have form taking approx 6000 data , when submit insert these 6000 rows insert mysq-db taking time , of time hanged.
note : rows created excel upload , after upload of excel created rows(6000) on php script (view) page. , after click on submit button store these rows data mysql-db.
my php/html page contains:
prod_id prod_name prod_sku created_on created_by modified_on modified_by 1 samsung xyz 2015-07-17 1 2015-08-18 1 2 micromax abc 2015-07-17 1 2015-08-18 1 3 htc des pqr 2015-07-17 4 2015-08-18 4 4 htc fly mvc 2015-07-17 44 2015-08-18 44 5 lg g2 uvw 2015-07-17 66 2015-08-18 66 6 lg g4 xyz 2015-07-17 22 2015-08-18 22 7 sony lmn 2015-07-17 44 2015-08-18 44 8 dell def 2015-07-17 1 2015-08-18 1
for loading huge amounts of data mysql, load data infile
far fastest option.
[approx- 40,000 rows]
first, convert excel file csv.
these steps can used emulate functionality:
create new temporary table.
create temporary table temporary_table target_table;
optionally, drop indices temporary table speed things up.
show index temporary_table; drop index `primary` on temporary_table; drop index `some_other_index` on temporary_table;
load csv temporary table
load data infile 'your_file.csv' table temporary_table fields terminated ',' optionally enclosed '"' (field1, field2);
copy data using
on duplicate key update
show columns target_table; insert target_table select * temporary_table on duplicate key update field1 = values(field1), field2 = values(field2);
remove temporary table
drop temporary table temporary_table;
using show index from
, show columns from
process can automated given table.
Comments
Post a Comment