Web Hosting Talk







View Full Version : Just making sure..


krissauquillo
05-24-2007, 07:03 PM
Basically I have information from my website that gets pulled by about a hundred people at a time, but that information does not change all the time, some times it may change twice in an hour, or not even once a day.

Which method would be safer/faster? (40 is just the number of users rows that it is pulling at most)

A) 40 flat .txt files (each with different data) that PHP refererences each time.

B) Or one SQL query that pulls the 40 rows each time.

foobic
05-24-2007, 08:33 PM
Are you thinking about trying to recreate the database as flat files? If so, don't do it!

If you're concerned about performance then cache the results of common queries (MySQL will do this itself if you have access to the setup). Better still, if your application allows it, would be to cache the entire page and serve it directly without involving PHP at all.

mwatkins
05-24-2007, 09:36 PM
Why do you want to worry about optimization? Is there a reason? Are the 100 people pulling the info every second? or once a minute? Or once an hour? One a day? multiple times randomly through the day?

A modern web server can handle many thousands of requests every minute, even if there are some SQL activity, there doesn't appear to be, as you've described it, even a reason to consider optimizing right now.

Build your solution in a manner that allows you to deliver the functionality you need and don't worry about optimizing the heck out of it at this point.