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?:
- Create a table votes to store all the votes of all entities?
votes - vote_id - user_id - type (articles, blogposts or users)
- 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