I want to introduce a Facebook-like "likes" system, in that my members can click a like (or dislike) button and it rates the post up or down. A tally of the likes should be visible.

My first (and only) thought of implementing this is to create a new "likes" table in my MySQL database. But when I look back on websites such as Facebook and YouTube, who have billions of likes for all of their videos, it seems resource consuming to have a table that may contain that many entries.

The structure of the table would be

id, post, value, user

Are there any alternatives to using a MySQL table for "likes" ?

Accepted Answer

Are there any alternatives to using a MySQL table for "likes" ?

There are, but what are you afraid of? A mySQL table is one of the most optimal forms to store lots of data in.

You could look at noSQL databases and other forms of data storage, but my bet is you can easily stick with mySQL at the moment, and switch storage engines later if the project starts growing so massively that you need to go beyond relational databases.

Written by Pekka
This page was build to provide you fast access to the question and the direct accepted answer.
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki