Jump to content

Recommended Posts

Hey there,

 

I'm going to have a shot at making a PHP forum but I've recently read about Database normalization and i have a few questions:

 

1) Should i apply it to my forum - what advantages will it provide?

2) I'm not 100% on the rules and wonder if for the for example a threads 'number of replies' should reside as a column within the table that stores the threads title/ID etc or should it be in it's own table such as "THREADS_THREAD_REPLIES". Or is this wrong/overkill or more likely me just over-thinking again :P

 

Thanks guys

Link to comment
https://forums.phpfreaks.com/topic/167008-normalization-with-php-forums/
Share on other sites

Hi

 

For normalisation you could argue that you do not have a column for the number of replies on a thread (just count them when required). However for efficiency you are best to sometimes ignore full normalisation (ie, not point calculating something thousands of times), in which case it would be best to keep it in the table of threads.

 

However remember that this means an extra field to update (and an extra field to get out of step).

 

All the best

 

Keith

That extra field means that there is more chance or 'corrupting' the row by constantly updating the field right? So would it be safer to have a seperate table that just has thread_ID and NUMBER_OF_POSTS so that if updating the amount of posts messes up at least the THREAD details are still in tact?

 

Thanks

Hi

 

Chances of an update are pretty limited, but realistically I would not think having an extra column to be updated would make it more likely to have an error. Adding an extra table would just need an extra table to be updated.

 

All the best

 

Keith

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.