Old 01-15-2005   #1 (permalink)
Invicible Snake
 
ParaSnake's Avatar
 
Join Date: Sep 2004
Location: Ho Chi Minh City,Vietnam
Posts: 668

Send a message via MSN to ParaSnake Send a message via Yahoo to ParaSnake
Unhappy I need solutions in making forum...

uhmm.first ..i stuck in database...i dont know whats is the best choice for me..should i creat 2 table osts and threads?or i will join them into 1?
das the first question..thx for helping
__________________
ParaSnake is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 01-16-2005   #2 (permalink)
Moderator
 
Join Date: Jul 2004
Location: Quebec City, Canada
Posts: 50

For such a scenario, no matter the way you look at it, you definately want two distinct tables. On an hierarchical level, a post is a post, and a thread is a thread, and not all attributes needed for one are needed for the other.

A truly relationnal database scheme would have to look like the one below, meaning that each piece of data should be stored at one and only one place. You can achieve that by linking your tables together when you query your database.

However, while that's perfectly fine in theory, a real-time database for a forum needs to be fast at (nearly) all costs. To achieve better performance you might want to do some caching (i.e. storing the subject, date, author, replies) in the threads table, so that the posts table and index don't have to be scanned for each thread when all that you want to do is show a forum index. In short, you eliminate a LEFT JOIN, which can be a good thing performance-wise.

Also, I've seen forums such as phpBB store their post information (author, thread, date) and their actual post contents in seperate tables. However to me it seems that the advantages of keeping the physical file size down actually do not outweight the overhead caused by the need for an other LEFT JOIN in your queries, where the database server has to do yet an other index scan. That's open to interpretation, though.
Attached Thumbnails
i-need-solutions-making-forum-forumscheme.png  
The Eagle is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 01-16-2005   #3 (permalink)
Invicible Snake
 
ParaSnake's Avatar
 
Join Date: Sep 2004
Location: Ho Chi Minh City,Vietnam
Posts: 668

Send a message via MSN to ParaSnake Send a message via Yahoo to ParaSnake
While i was waiting for answer..i completed the structure of my mess board...i decided to use 2 table
1 is threads:threadID,content,poster
another is postsostID,threadID,userID,content,poster,date
so that i can use the threadID to define the post and the reply
Will this make the script slower?
__________________
ParaSnake is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT +1. The time now is 08:29 AM.
Content Relevant URLs by vBSEO 3.2.0

Design & Content © BioRUST 2008 :: PRIVACY STATEMENT :: LEGAL INFORMATION :: ADVERTISING MEDIA KIT