4

While I found some good articles about reputation systems in general, and Stack Overflow in particular, I didn't find any article about the data model used.

I know the data is stored in a MS-SQL database so it is some kind of relational model.

I am especially interested how the reputation points are stored (by user, by entity that has the points, in both). In my opinion the reputation is like a currency and you could implement it like real bookkeeping (with transactions and consistent sums on creditors and debtors). But is it implemented this way?

1
  • Thanks - i think this is worth an "answer". are there any checks between the redundant values? could they differ in any way? does this matter?
    – dermoritz
    Commented Jan 6, 2016 at 11:55

1 Answer 1

13

The exact database schema is not known but we can get a glimpse of it by looking at what is available in the Stack Exchange Data Explorer. The data dictionary is described in Database schema documentation for the public data dump and SEDE and I've used that combined with the information schema info to create an ERD.

If you look at those tables you'll see that the users table has an attribute reputation. That field is a redundant value, stored there for performance reasons.

To calculate the reputation you'll have to look at the votes and certain actions. The votes (up/down/accept) are stored in the votes table, a row for each vote indicated with the votetypeid (up=2, down=3, accept=1 etc). Each type of vote carries its own reputation. Approved suggested edits also gives reputation, those are found in suggestededits if you filter on ApprovalDate is not null.

If you bring all that data together you can create an graph of your reputation over time as I show in this answer. That is what you would call the transactions

On any site you can audit your reputation. Back in the days that page also had a re-calc button which you could click if there was for some reason a discrepancy between the reputation in your profile and what you should have based on your posts.
You'll find questions on that topic in the tag .

Today if there is a difference we blame caching.

2
  • one little question remains: how are downvotes represented in data base? As a special type?
    – dermoritz
    Commented Jan 7, 2016 at 11:36
  • Down votes are in the Votes table, votetypeid = 3 (downmod)
    – rene Mod
    Commented Jan 7, 2016 at 11:37

You must log in to answer this question.

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