Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 157 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 would like to implement something similar on my blog.

Anybody know the schema or how it is done?

share|improve this question

migrated from Mar 1 '10 at 16:01

This question came from our site for professional and enthusiast programmers.

try this in – Teja Kantamneni Mar 1 '10 at 12:51
The referral to meta seems odd. This is a technical/programming question, which happens to discuss a feature of SO, but would we answer it here, if a similar question was asked about say the tag feature on some other popular blog site? – mjv Mar 1 '10 at 13:04
why close this? it is a perfectly legal programming question. – Raj More Mar 1 '10 at 13:16
It's not a close-vote, but a referral to a section of SO (meta) where this question can be answered more accurately. According the title of this thread, Tapha specifically wants to know how SO implemented this (in which case it belongs on Meta-SO), but then Tapha says "... something similar ...", in which case it can indeed be asked here. – Bart Kiers Mar 1 '10 at 13:29
@bobb - Looks like you're digging for the Archaeologist badge :P – Lix Apr 2 '12 at 7:13
@Lix: Uh, now that you say it, that's a nice idea...but I fear retagging alone does not count...but now that you mention it, sorting questions by "newest" and going to the last page smells like a serious sinkhole for my time. ;P – Time Traveling Bobby Apr 2 '12 at 7:18

I would imagine it's something like this, no need to overly complicate it:

Question Table

  • QuestionID
  • Something
  • Something

Tag Table

  • TagID
  • TagName
  • UserID (creator)

Mapping table with some name

  • QuestionID
  • TagID

Possibly revision ID on the question and mapping table so you can tell which revision the tags went with, not positive here how they store revisions.

I would say this because it allows you to see

  1. How many times a tag is used
  2. How many answers a user has related to a tag (badges)
  3. Easily get a tag list for auto-suggest (cached anyway I'm sure)
  4. Quickly get a list of tags for a question
  5. Filter a search by tags (as you can do via query parameters)
  6. See who created the tag (badges again)
share|improve this answer
That would be the typical database style, but the problem is that when you're talking about seriously high performance databases, you want to avoid joins where possible. Your setup would involve multiple joins per question - we'd have to fetch several rows in the mapping table for every single question query, plus the related Tag records. – Brent Ozar Oct 18 '10 at 1:02
What would be a the correct solution for a high performance database then? – Jonathan Levison Jun 6 '12 at 12:03
@JonathanLevison - Since being hired I can add a bit here: we store the tags in a delimited fashion right on the Posts table, but also in a relational PostTags table and a Tags tables mentioned above for other queries. So the above is true, it's also stored in a column on the Post directly for raw speed. – Nick Craver Jun 6 '12 at 12:08
Cool, thanks for the additional info. I guessed it is some sort of additional (not normalized?) data structure. I am guessing that the main motivation is getting the questions to load up as quickly as possible at expense of storage? – Jonathan Levison Jun 6 '12 at 12:51
@JonathanLevison - both, think of the tags as being stored in a space delimited format in a text field (if we were to build it right now, that's what it would be and would be just fine). And yes...speed is kind, we're absolutely anal about performance and we can always buy more storage (though in the grand scheme...this column is insignificant) – Nick Craver Jun 6 '12 at 12:54
Awesome, thanks for sharing :) – Jonathan Levison Jun 6 '12 at 13:15

You must log in to answer this question.

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