I have written a PHP script which loads a text file into an empty MySQL database table. I have versions of the script which use INSERT INTO and LOAD DATA INFILE. This test is being run on a Dell PC with XP SP3, Intel Core 2 1.86GHz, and 2 GB RAM. The text file is a syslog containing 80,000 records of 31 fields each.
With either version of the script, the MySQL query process always takes about 40 minutes and the PCs processor utilization is never above 2%. Memory utilization is around 521 MB. Changing the process priority has no effect. Running the test on a different PC (same O/S, different model PC, comparable specs) also has no effect.
The query takes at least 10 times longer than it should. Can anyone suggest where to look to solve this performance issue?
Thank you VERY much for your assistance.
Newbie PHP MySQL Performance Issue
Moderator: General Moderators
Re: Newbie PHP MySQL Performance Issue
Seems like the bottle neck is file reading and inserting it into database. I hope you don't use the whole file reading into one variable and then make some tokens for database insert. Fastest way what i think would be read line and then insert to database. I am sure the problems hides in code. So if it's not long then post here. 
I suppose you use prepared statements, PDO or mysqli
I suppose you use prepared statements, PDO or mysqli
Re: Newbie PHP MySQL Performance Issue
That gives me some focus for some research. I appreciate it very much.
Thanks.
Thanks.
Re: Newbie PHP MySQL Performance Issue
(Let me work on the code a while then I'll post it if I can't work past this knot. Thanks!)