Jump to content

Recommended Posts

I am making a mammoth database schema in Mysql Workbench - a great tool to visually design your schema.

 

I'm creating a commenting system on my webpage. Each news article would have "+/-" rating system along with comments. Things get a bit complicated though - the +/- count should be live and the latest comments need to be shown (within one minute of posting). I will have a separate table to keep track of all users who rate +/- to prevent double voting.

 

This is where things get complicated - how do I keep track of the +/- live? I have read several books and watched numerous mysql optimization techniques. I'm currently designing for the InnoDB storage engine. However, innodb sucks in counting rows. I have read somewhere you should create a row to increment/decrement the value, and run a cron job once an hour to "make sure the value is up to date by couting all the ratings.

 

Any sight on this entire thing? I know it sounds like a lot, but this is the first time I'll be having 50+ tables.

Link to comment
https://forums.phpfreaks.com/topic/155179-mysql-rating-track-votes-in-real-time/
Share on other sites

Hi

 

While a count field works fine it would not be live. However no reason you cannot incremet / decrement the count field whenever a vote is added. Not perfect for database normalisation, but probably a good idea for efficiency (assuming reads will outnumber the updates).

 

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.