dimanche 30 mars 2014

generic votes table vs seperate votes tables?


Vote count:

0




I want to implement a vote system for several different entities/tables(e.g. articles, blog post, users).


What is the best/more efficient approach?:



  1. Create a table votes to store all the votes of all entities?


votes - vote_id - user_id - type (articles, blogposts or users)



  1. Create a table votes for each entity? votes_articles, votes_blogposts, votes_users


What I see is: First option will result with a bigger table and there's an additional field which i need to include in my queries. More generic table that can be easily extended for more entities if needed and everything is kind of centralised. (can use a generic function to retrieve/insert/update the table)


Second option will result with smaller tables; faster to query? but necessarily better to maintain.



asked 33 secs ago






Aucun commentaire:

Enregistrer un commentaire