MySQL thousands of updates, slowing down.
- by noryb009
I need to run a PHP loop for a total of 100, 000 times (about 10, 000 each script-run), and each loop has about 5 MySQL UPDATES to it. When I run the loop 50 times, it takes 3 sec. When I run the loop 1000 times, it takes about 1300 sec. As you can see, MySQL is slowing down ALOT with more UPDATEs.
This is an example update:
mysql_query("UPDATE table SET `row1`=`row1` +1 WHERE `UniqueValue`='5'");
This is generated randomly from PHP, but I can store it in a variable and run it every n loops.
Is there any way to either make MySQL and PHP run at a consistent speed (is PHP storing hidden variables?), or split up the script so they do?
Note: I am running this for a development purposes, not for production, so there will only be 1 computer accessing the data.