The common normalized structure of database for a forum is to store all posts in a table where a column define the thread number. To display a thread, we need to perform SELECT
with WHERE
clause for the thread number (sorted by date). In this case, we deal with a very long table for every query.
Is it really the best way to store posts and threads for a forum?
It is more complicated for a Q&A like stockexchange projects, as in addition to answers (i.e. identical to posts in forum), each answer can have comments.
What is the most efficient database structure for a large website like stackoverflow?
It's far from being as large as SO, but in my application, the model I chos was to have each post have
This allows getting easily