Results 1 to 1 of 1
Jan 25, 2013, 13:21 #1
- Join Date
- Mar 2002
- 0 Post(s)
- 0 Thread(s)
MySQL: Optimal query plan/design storing and updating user stats
I have a members tables and downloads table to store member uploads (both MyISAM). I'm storing downloads, likes, dislikes and favourites in each table, with the members table storing the totals from all uploads by the user.
When an event happens (download, like etc), I am updating the downloads table and incrementing each field without incrementing the totals in the members table. To update the members table stats I run a script which does SELECT SUM(likes), SUM(downloads)... etc depending on users activity, which processes the numbers before doing the update query.
What I want to know is it going to be a lot more resource intensive to issue a real-time update on the members table alongside the update to the downloads table, upon each event, or it is better to calculate member stats separately? The problem with the 2nd method is the user must be active otherwise the stats will not update.
I'd appreciate any advice.