How does Stack Overflow keep track of the number of questions under a tag as well as the number of votes, views, answers per question, etc? I'm just eager to know if they maintain a separate table or do a count query every time.

  • 1
    Take a look at an open source alternative: osqa.net check their database schema.
    – Marcelo
    Sep 1, 2011 at 17:57

2 Answers 2


Not quite a duplicate, but a fellow MSO user posted an interesting writeup about this at Dissecting the Stack Overflow views counter. Excerpt:

From what I can tell there is now a JavaScript section in each answer page (used to be CSS in 2008):

<script type="text/javascript" src="/posts/3590653/ivc/a947"></script>
    <div><img src="/posts/3590653/ivc/a947" class="dno" alt=""></div>

The last part of the URL - a947 - seems to be dynamically generated. It is changed every 15-20 minutes and is the same for all questions and presumably users (I tried anonymous access, changing my IP address, it stays the same during the interval).


Just use a database of questions and answer.

Each user has a unique ID to query on.

You must log in to answer this question.

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