mysql_query takes long time...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux