|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
text vs database
is it beter to have some info stored in text files or a database? would text be good mostly if you have no database capabilities? are there any articles on the subject? what are the pros and cons? Just thought it would be interesting to know. thanks.
__________________
hey it's the CHARKING |
|
#2
|
||||
|
||||
|
The first database work I ever did, I did using a combination of text files and a database. I did so without really knowing why. I think I was a little gun shy about storing lots of text in a database, unsure at the time whether or not databases were really meant for that. So my database stored meta information and a path to a file, and my code did queries and then file I/O to display and modify text. It was a pretty inefficient way to do things.
My view -- and I'm no super expert or anything, though I have a fair amount of experience now (years after that first attempt) -- is that if you can store it in a database, you should. You avoid having to handle locking files, for example, and you dodge having to write search routines and ensure that you're writing unique filenames, etc. I suspect that in most cases, people who use flat files to store text are doing so through inexperience, as I was, or they don't have database capabilities, as you've proposed. I'd be interested in hearing if anybody out there can give a good justification for using text files when other options are available. I suppose that if you use text files, you can have your content/text editable through a regular filesystem and thus can dodge having to create an interface for maintaining content. Using flat text files and having content developers mount the drive they live on could be a poor man's content management system, in other words. |
|
#3
|
|||
|
|||
|
Quote:
What are your thoughts on BLOBs? I've heard that images are slower to pull from a database than from a file. Any other pros/cons? Storing data in files also leaves a smaller database file to backup. |
|
#4
|
||||
|
||||
|
Yes, for images, I would typically store a reference to a path or filename and let the filesystem handle the rest. The difference is that you're not frequently making small edits to images, as you might for content. But I would store text in the database. That's a good followup question to have asked.
|
|
#5
|
|||
|
|||
|
There is also the possibility to store pictures in the db and chace them on the server as they are needed.
|
![]() |
| Viewing: Dev Articles Community Forums > Databases > Database Development > text vs database |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|