As I've said in a number of previous threads, I'm trying to figure out the best way to handle what to do with my 1 million-plus update queries that my site needs to run every day.
The UPDATE queries are slowing my site down, due to locking the table, so I'm thinking of having all updates going to a single table meant just for those. However, I do have some questions.
First, if I have an UPDATE query on one of my pages, will that page not load until that UPDATE query runs successfully? Or is the UPDATE query just sent to the MySQL server and the rest of the PHP script on the page is processed. My concern is whether the page waits for some sort of completion response on the query itself before moving on.
If it does in fact have to wait for the UPDATE query to complete, is there a way I can run this query from an external php script with the same UPDATE query in place?
Any information appreciated.
Yes, the script will wait for the query to execute.
Yes, you can decouple the query from the script if you don't need it to happen before displaying the page.
Shuffle off all those queries into a buffer somewhere (an in-memory database, or append to a text file) and have a separate process run the unexecuted queries in batches.
Though, I'd hold off on engineering all this until you're sure you need it. I'll reply in your other thread about the database stuff. You can probably resolve the locking issue and not worry about saving a few milliseconds by decoupling this stuff.