Most efficient way to store "likes" like Facebook and Stackoverflow
<p>What would be the best way to store "likes" or "upvotes" in a mysql database?</p>

<p>Here was what I was thinking:</p>

<pre><code>likes (table)
    id (auto increment)
    post_id
    user_id
</code></pre>

<p>but would the <code>likes</code> table have millions or even billions of rows since each person that would like a post would insert into 1 row and each person can like more than one time and there's more than one user.</p>

<p>how does facebook or stackoverflow manage to do this in a database? any links or guides is appreciated. thanks.</p>