Help - Search - Members - Calendar
Full Version: Retrieve text from files vs database
InsanelyMac Forum > Everything Else > Creativity > Web and Graphical Design
SquidCombo
Hi guys,

I need help, which one would be the better choice if I want to keep CPU Load and bandwidth usage to the minimum? Although I'm going to use PHP for this, I think it applies to any web programming language.
I am Dice
hmmm... well not knowing what your really doing with this and how much info you have. I would think DB..

Dice smile.gif
SquidCombo
What I want to do is for a user to be able to search for a log using some sort of a log code. So I can do either:
1. When a user enters the code to search, a hash function would convert the code so that the result would point to the corresponding file and the display page would parse the text in the file.

or

2. Have the logs in the database, so when the user enters the code to search, the display page would query the database and look for the corresponding log. The database returns the log.
I am Dice
So you want like a document manager?

There are many tools out there for that. but if you want to build it I would think a db would be the best. I think it would be easier to manage as well.
lord_muad_dib
writing/fetching data directly from a file is slower and(depending on the site traffic) leads to problems

its better to use a db, designed for multi accesses per time.
SquidCombo
I have to keep track of 1000 logs and the logs are frequently updated (one entry every minute). Would it be better to write the logs in separate xml files and then retrieve them according to the xml filename or writing the logs to the database is still faster. I'm just afraid that the database entries would be too big.
emig647
Database hands down. All the data is indexed and quickly accessed. There are very rare instances to ever use text files... I started to type one, but nope that one would be better in a db too rolleyes.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.