Large strings: Text files or SQL DB?

Posted by Tommo on Stack Overflow See other posts from Stack Overflow or by Tommo
Published on 2010-06-16T21:32:45Z Indexed on 2010/06/16 21:42 UTC
Read the original article Hit count: 180

Filed under:
|
|
|
|

I am coding a forum system using PHP.

I am currently storing a threads ID, title, author, views and other attributes in an SQL database and then storing the thread body (the HTML and BBcode) in text files inside a folder named after the thread ID.

In practise it's really simple to grab the database values then just grab the thread body from the text file, but I was wondering if this is the 'proper way'? I have personally no problems doing this but if it turns out it is massively inefficient and I should instead store both the thread body HTML and BBcode in the database instead then I will change.

However, to me it seems wrong to store such a (very possibly) huge string of multi-line text along with lots of different characters in a database - I was taught that databases are more for short field 'values' rather than website content.

I would just like a definitive answer to this because it's been bugging me for ages as to wherever I’ve been doing it properly.

Does anyone know how popular forum systems store threads?

© Stack Overflow or respective owner

Related posts about php

Related posts about sql