htzone Posted November 24, 2008 Share Posted November 24, 2008 I'm going to be writing a script that compares a column of values found in two different database tables on a daily basis. My question is this - is it more efficient to run my MySQL queries once and keep the data in a PHP array (and work with it in that form thereafter), or to query the database each time for every row in one of my tables? Basically, a single row in one table needs to be checked against every row in the other table (and this process needs to repeat for every row in the first table). Hope I'm making sense. I'm just not sure which way is going to be more efficient - advice? I suspect that putting the brunt of the work on the MySQL server is the way to go, but I'm not certain. Quote Link to comment Share on other sites More sharing options...
ram4nd Posted April 8, 2009 Share Posted April 8, 2009 Array is faster i guess, but it doesn't matter, use witch is easyer for you. If you are makeing big site where will be loads of visitors at the same time, then i would suggest fastest scripts. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.