Every once in a while I'll need to run an extremely time-consuming query that compares two or more tables in a database and updates multiple tables from there. Realistically speaking, it would take way more than 30 seconds to compute. Sometimes, and there are numerous occasions that I've run into, it's not realistic to do everything on your local server (where you can extend the execution time) and you must do it on the non-accessible server where you host your site.
My trick is to load the content into a $_SESSION, loop through the that session and after every 50 to 100 iterations, refresh the page. After each iteration the current value of the session is unset to avoid duplicate values. After all values have been unset, the script will end.
My trick is to load the content into a $_SESSION, loop through the that session and after every 50 to 100 iterations, refresh the page. After each iteration the current value of the session is unset to avoid duplicate values. After all values have been unset, the script will end.
Comments
Post a Comment