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?
–
mjvMar 1 '10 at 13:04

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 KiersMar 1 '10 at 13:29

@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 BobbyApr 2 '12 at 7:18

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 OzarOct 18 '10 at 1:02

What would be a the correct solution for a high performance database then?
–
Jonathan LevisonJun 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 LevisonJun 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