snapplepitchcoc
07-18-2008, 06:27 PM
I am building an online forum. I've found that performance improves if I use one table for the thread title, author and number of replies and a separate table that contains the thread title, author, respondents and thread content. In other words, my current database has some duplicate data.
Creating a new thread requires two inserts: one into the 'Title' table and one in the 'Content' table. Replies require me to update the number of replies in the 'Title' table and add the content to the 'Content' table. I like this approach because it simplifies the SELECT statements. I anticipate that SELECTS (i.e., viewing pages) will be more common than INSERTS (i.e., posting a reply) so it seems like a good idea. The additional overhead to INSERT into two tables (e.g., I have to lock and unlock the tables) isn't too noticeable since the amount of data to be inserted is small.
I have reference keys in place in case content needs to be removed from the database.
Does this approach sound reasonable to you?
Thanks in advance!!
Creating a new thread requires two inserts: one into the 'Title' table and one in the 'Content' table. Replies require me to update the number of replies in the 'Title' table and add the content to the 'Content' table. I like this approach because it simplifies the SELECT statements. I anticipate that SELECTS (i.e., viewing pages) will be more common than INSERTS (i.e., posting a reply) so it seems like a good idea. The additional overhead to INSERT into two tables (e.g., I have to lock and unlock the tables) isn't too noticeable since the amount of data to be inserted is small.
I have reference keys in place in case content needs to be removed from the database.
Does this approach sound reasonable to you?
Thanks in advance!!