Is it better to store user text (such as a blog entry or private messages) in the database or as flat files?

Posted by Fredashay on Stack Overflow See other posts from Stack Overflow or by Fredashay
Published on 2012-03-30T22:35:43Z Indexed on 2012/03/30 23:30 UTC
Read the original article Hit count: 141

Filed under:
|
|

I'm building a social networking type site that will be storing large chunks of text that's entered by users, such as blog entries and private messages. As such, these will be entered once, with minimal revisions, but many reads by multiple users over time. I'm using MySQL, by the way.

My concerns are:

  1. Storing large blocks of text on the database will fill the database to capacity eventually.

  2. I read somewhere that storing user text in flat files is a security risk? (The filenames will be generated dynamically by the PHP, not by the user.)

  3. Storing them as text files may cause them to become out of sync if I ever have to reinitialize the database and restore it from backups.

What are all your thoughts and advice, pros and cons?

© Stack Overflow or respective owner

Related posts about database

Related posts about file