Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 158 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

I have trouble understanding this. If Stack Overflow can detect whether a user has already upvoted a question, does it have a flag for each and every post in a table, and whether a user has upvoted it.

If not how does it detect if a user is 'spamming' votes then?

share|improve this question
up vote 6 down vote accepted

Have a look at the schema on the Data Explorer and you can see the Votes table:


So they just record each post/user/vote type combination as required.

Obviously there's going to be some logic in there to prevent an single user having both an up and down vote on the same post, or that only the question owner can cast a "accepted answer" vote on their answers, and so on.

share|improve this answer
This is an incredible amount of data to be stored – liamzebedee Sep 20 '11 at 10:46
@Liam maybe, but it's the bare minimum, isn't it? – Pëkka Sep 20 '11 at 10:50
@Liam Disk space is fairly cheap – Justin Sep 20 '11 at 10:54
I guess, as the internet expands, and electronics according to Moores law, it will all become smaller, more efficient. – liamzebedee Sep 20 '11 at 11:22

Yes, it will have. However, it would also seem that they cache the score of a question in the post table for performance reasons.

I also believe that this cached value is recalculated periodically.



  • user_id
  • post_id
  • amount


  • id
  • score /* Cached value of SELECT SUM(amount) FROM Vote WHERE post_id = id */
share|improve this answer
Here's another test for push notifications. Did you get it? – Geoff Dalgas Jun 11 '14 at 15:18
Certainly did this time :). Awesome! – Matt Jun 11 '14 at 15:19

IN SO database, there is a Votes table which contains PostId, UserId, and VoteTypeId columns. VoteTypeId=2 is for UpVotes and 3 is for DownVotes. So I guess you are right that it does have a flag for each and every post.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .