phpfan101 Posted November 18, 2010 Share Posted November 18, 2010 What I have, is a php page that runs over 60 query's a visit, and has over 2000 visits a day. That thousands of query's, and I'm sure this can be simplified easily to lessen the load. I only need to update the data on the page every 12 hours. So, what I'm thinking, is that it would be best to run the query based on time()(every 12 hours), and store that data in a .txt file. Then, the php file, instead of requesting the query over and over, it just extracts the data from the text file. Does this help me at all, or is it useless? is there a better method? Thanks! Quote Link to comment Share on other sites More sharing options...
simshaun Posted November 18, 2010 Share Posted November 18, 2010 I think it would be better to implement query caching. Every 12 hours, run the query and store its output in a single row of a "cache" table. Quote Link to comment Share on other sites More sharing options...
papaface Posted November 19, 2010 Share Posted November 19, 2010 Yes, caching the output of the page is your best bet in this scenario as the data is the same for 12 hours per day. Quote Link to comment Share on other sites More sharing options...
phpfan101 Posted November 19, 2010 Author Share Posted November 19, 2010 Ahhh, didn't even think of storing the output itself in the db, then it only runs one. cheers! Quote Link to comment Share on other sites More sharing options...
btherl Posted November 19, 2010 Share Posted November 19, 2010 Storing it in a text file may be faster than storing it in the db, depending on the data and how you query it. A more heavy duty solution is memcache, but that would be more suitable for higher levels of traffic. There's nothing wrong with the concept of storing the data in a text file. 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.