Thanks for the response robothy,
I should have stated my problem a little more clearly.
The problem is that the script timeouts before the whole set of data is finished. Also, if I try entering the data in one long query, mysql timeouts.
The most efficient way I have found is to do it in chunks but it's certainly not optimal.
I was curious if there is some feature of mysql (or php I guess) that I am overlooking to quickly update record set with over 10k rows.
Since the script times out, I assume you are attempting to do this via a web browser/server. If you don't have shell access to the server, you may be stuck doing it in chunks. However, there are almost always ways around limitations when Linux is involved.
One idea:
- Have your PHP program look for a flag file, say, UPDATING.
- If it's not updating and did receive the form data, it grabs the uploaded file, forks off a shell script that (1) creates the flag file, (2) executes a mysql() process to execute the SQL script, and (3) deletes the flag file. The PHP then falls through to (c).
- If it is updating, it sends HTML to your browser that (1) says "UPDATING", (2) shows the ps() status of the mysql() program doing the updating and (3) reloads the PHP program after 20 seconds
- If it's not updating and didn't receive the form data, it presents a form to you to upload a MySQL script containing all your updates (see mysqldump() for an example)
- You select your SQL script and click the button.
Mind you, this is an ugly, bare-metal solution that
should work with browser/server without timing out. I'm sure others (even you) can pretty it up. And you might want to include a way to kill the script if it runs away.
I haven't tried this myself, but I probably will at some point, since I'm stuck working on a web site that has no shell access. Slow FTP access sure does make for inflated billing hours and infuriating waits for FTP to connect, transfer, disconnect. Give me secure-shell access!