I collect how people tag topics with categories in table like:
ID | topic_id | votes_Category_1 | votes_Category_2 |.......... | votes_Category_12
This table holds 1 row per topic and dynamically keeps count of votes on each category I dump this table every hour for history reasons. Lets say table contain 2 million rows. dumped every hour in history tables.
This solution is not flexible (that is minor because categories are pretty solid) if I want to add column Category_13, so I'm thinking about this one:
ID | topic_id | Category_id | vote_count
This solution will create 12 rows per topic, its better structured and more flexible but I'll have to dump every hour 24 million rows.
I need the best 10 topics in each category!
- case 1: order by votes_Category_x desc limit 10
- case 2: where category_id=x order by vote_count desc limit 10
Which one would be better JUST!!! from performance stand point:
- To have 2 million rows with 14 columns
- To have 24 million rows with 4 columns