You can also stack the queries to run multiple rows in one insert
Insert into table values (row1col1, row1col2,'row1col3'),
(row2col1,row2col2,'row2col3'),...(rowNcol1,rowNcol2,'rowNcol3')
Bastien
Sent from my iPod
On May 31, 2009, at 8:18, דניאל דנון <danondaniel@xxxxxxxxx>
wrote:
I've a file of about 500,000 lines, each line contains a string in
variety
of lengths, but no less then 3 characters and usually no more
then.... 120.
average of about 80, and maximum of about 250.
I made a PHP script to fetch the data (using fgets), process it and
insert
it to a MySQL database.
The problem is inserting to MySQL takes about 0.02 seconds, which
looks like
nothing - but when you have 500,000 lines to insert...
The while goes like that:
fgets from file
x1 = some function about the string
x2 = some other function about the string
x3 = the string
insert into table (field1, field2, field3) VALUES (x1, x2, x3)
(pseudo-code)
I was wondering, is there any faster way to perform it, assuming I
have to
do it with PHP?
also, if it matters - the MySQL table got id in auto increment.
Yours, Daniel.
--
Use ROT26 for best security
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php