What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 133 Stack Exchange communities.

For example, let's take the nice question badge; it can be awarded in two ways that I know of:

  1. Count() votes where voteTypeId = 2 and 3; deduct downvotes from upvotes and award badge if remainder is > 10
  2. Check the value of posts.score and award badge if its > 10

How is data integrity governed? By the votes table or the posts.score table?

I imagine some type of callback after insert/update would work. But does it happen on votes inserts or posts.score updates, or neither? Or no callback at all, and some type of polling event? Or some type of arcane black magic?

share|improve this question
4  
Does SO use normalized or denormalized data to award badges? Yes –  XMLbog Dec 15 '10 at 14:45
    
@Welbog, I don't understand, but am I to assume that answer is yes for both scenarios? –  Mohamad Dec 15 '10 at 14:58
    
You're to assume that you've asked a very broad question, and the most likely answer is that different badges work in different ways. –  XMLbog Dec 15 '10 at 15:40

1 Answer 1

up vote 2 down vote accepted

Does SO use normalized or denormalized data to award badges?

Sometimes we use normalized data, sometimes we use denormalized data. Depending on the badge.

We also have regular jobs that sync up denormalized data, in case something went wrong. Votes table is golden, if the Posts.Score is ever out-of-sync we will dump it and recalculate using the Votes table.

share|improve this answer
    
waffles, many thanks. But how could you tell when the Post.Score becomes out of sync? Do you have a scheduled event that does the counts every so often? –  Mohamad Dec 17 '10 at 1:00
    
yeah @Mel ... we validate it daily –  waffles Dec 17 '10 at 1:21

You must log in to answer this question.

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