FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


mysql database schema, blogs, forums and their text





coeus
According to http://www.phpbbdoctor.com/doc_columns.php?id=10 the phpBB database seperates the post topic and text into 2 different tables.

table 1: post id, forum id it belongs to

table 2: post id, subject and text

Is there any benefit to doing it that way rather then just having one table with each post as an entry? It's not like the subject and text are every going to be repeated a ton.

The reason I am asking is that I am working on making my own blog system, using php and mysql and trying to figure out a database schema. Also how I plan to implament tags. Smile
MrBlueSky
The data in table 1 is needed a lot more often then the data in table 2. The data in table 2 is only needed when viewing a topic. The data in table 1 is needed for almost every view: the index, active topics, post-counts, latest post, sub-forum index, etc.
The data in table 2 on the other hand is large. When you use one table you get a very large table from which data is selected very often. This is much slower than having a (relatively) small table used often and a big table used not so often.
coeus
but if you don't grab that field in the select statement because you don't need it, isn't it the same thing as not having that field in the table?
MrBlueSky
That's a good point. I always took for granted that the design using two seperate tables was more efficient because of the reason I mentioned above and most forum-software uses it. But know I am starting to wonder if it really is, and if it is, why? Surprised
Related topics
Cron Job to Backup MySQL Database
Mysql database problem
PHPBB MYSQL Database Question.
MySQL database for a forum
Mysql database size?
Connect to MySql database
[MySQL database] Password and username
insert data to mySQL database problem
MySQL Database!?
Delete data from MySQL database problem!!
MySQL database
Problem connecting to MySQL database with PHP [RESOLVED]
Need Help with mysql database of DragonflyCMS
How to search in a MySQL - database
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.