which one consume less resources? opening text file or make an sql query,both a thousand times ?
Posted
by
imin
on Stack Overflow
See other posts from Stack Overflow
or by imin
Published on 2011-02-17T07:13:45Z
Indexed on
2011/02/17
7:25 UTC
Read the original article
Hit count: 152
hi
I've a php website which displays recipes www.trymasak.my, to be exact. The recipes being displayed at the index page is updated about once a day. To get the latest recipes, I just use a mysql query which is something like "select recipe_name, page_views, image from table order by last_updated". So if I got 10000 visitors a day, obviously the query would be made 10000 times a day. A friend told me a better way (in terms of reducing server load) is when I update the recipes, I just put in the latest recipe details (names,images etc) into a text file, and make my page instead of querying a same query for 10,000 times, just get the data from the text file. Is his suggestion really better? If yes, which is the best php command should I use to open, read and close the text file?
thanks
© Stack Overflow or respective owner