TheFilmGod Posted April 22, 2009 Share Posted April 22, 2009 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 More sharing options...
kickstart Posted April 22, 2009 Share Posted April 22, 2009 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 Link to comment https://forums.phpfreaks.com/topic/155179-mysql-rating-track-votes-in-real-time/#findComment-816454 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.