I am creating a web-application that handles internal emails along with other frequent small-to-medium-sized portions of text between customers and clients. What's the best way for storing this data? Inside a database (MySQL) or as 1000's of person files? How about blending it (PHP's gzcompress() or MySQL's compression features)?
This won't be a public application, therefore the user load is going to be minimal (under 20 customers at any given time). However, you will see lots of communication returning-and-forth every single day inside the application, and so i expect the quantity of data to develop quite large as time passes (and that's why Let me compress it).
Let me keep your data inside a database for convenience and portability, but a few of the threads I have seen on here regarding images have recommended using file storage. What is your opinion?
Edit for clarification: I don't require any kind of searching from the text, and that's why I'd lean toward blending it to reduce space.
For images and documents which are already inside a specific format (stand out, word documents, pdf files, etc) I favor file storage. However for just raw text I'd most likely rather make use of a database. It's simpler to duplicate across machines for failover, that you can do substring searches within the text and although I'm not sure of the specific formula to make use of to compress it, I'd believe that a database will be a better approach to take. But only when you have only the text which is only text. Every other format of document I'd prefer using file storage.
And unless of course I'm missing something I'd make use of a CLOB rather than a BLOB, if it's only text.
Among the primary causes of keeping the files inside a database would be to ensure that it stays in conjuction with the relaxation from the data that you're storing. It will likely be simpler to create backup copies, (re)deploy with predefined datasets etc. In addition it's simpler to ensure transactional integrity.
One benefit of storing text as files might be that it's simpler for everyone them utilizing a webserver, if this sounds like the only real remaining advantage of using files you can consider caching the files around the webserver -- that provides you with a lot of the simple backup and transactions from the database but simultaneously allow some speedup for http demands.
I'd have selected to utilize a DB. You describe a predicament where you will store a sizable volume of messages. You don't provide many details concerning the system, however i would reckon that you most likely want to sort, group and apply other qualities towards the messages. It might be much simpler and most likely faster to help keep the content using its characteristics inside a DB rather than using file storage.
If this involves compression I don't know which from the techniques is ideal. You need to most likely try both before selecting.
I question how large is "medium chunk". When the text is simply written messages (so under 10 KB), then blending means they are even more compact there would not be large effect on database growth. It can make developing and maintenance also much simpler to possess everything provided with singl query and never needing to obtain the file contents individually.