I have a PHP program running right now that is processing database rows of over 6 million. Considering the speed at which number of records have been processed so far, it looks like the whole process might take few days to complete (due to hardware limitations).

I was thinking if I could make changes in the program to remove unnecessary logging and other things that may be consuming time. Can I do this with the current program still running so that further processing would speed up, or will this cause the PHP script to break ?

  • Just out of curiosity - are you selecting rows and then updating/re-inserting them maybe?
    – N.B.
    Oct 3, 2013 at 11:22
  • @N.B. No, I am actually selecting each row and comparing it with every element of an array that has more than 10K elements.. Oct 3, 2013 at 11:25
  • 2
    @SachynK: In that case consider doing the opposite. Write the array in temporary table (index it as/if needed) and let the database engine do the comparing. It's much better optimized for that.
    – Jan Hudec
    Oct 3, 2013 at 11:56
  • thanks @JanHudec, but there are many levels of comparison.. and in the end, i have to export all the results in excel.. Oct 3, 2013 at 12:05
  • 1
    @SachynK: Even if you fetch all the results, having expressions in the select and only reading their results might still be faster. PHP is rather slow language.
    – Jan Hudec
    Oct 3, 2013 at 12:09

1 Answer 1


You cannot edit your program because it's compiled in memory. Any modification to the source code will be active after you reload the program.
This means that you have to kill the process and reload the script.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.