What is the best way to INSERT a large dataset into a MySQL database (or any database in general)
Posted
by
Joe
on Programmers
See other posts from Programmers
or by Joe
Published on 2011-09-06T13:50:01Z
Indexed on
2012/09/27
9:50 UTC
Read the original article
Hit count: 178
As part of a PHP project, I have to insert a row into a MySQL database. I'm obviously used to doing this, but this required inserting into 90 columns in one query. The resulting query looks horrible and monolithic (especially inserting my PHP variables as the values):
INSERT INTO mytable (column1, colum2, ..., column90)
VALUES
('value1', 'value2', ..., 'value90')
and I'm concerned that I'm not going about this in the right way. It also took me a long (boring) time just to type everything in and testing writing the test code will be equally tedious I fear.
How do professionals go about quickly writing and testing these queries? Is there a way I can speed up the process?
© Programmers or respective owner