Jump to content

Normalization with PHP Forums


aceband

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.