Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 158 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

Possible Duplicate:
How is the tagging system implemented here at S[O|F|U]?

I am currently building a website in which users can tag a submission, similar to that of SO, Flickr etc.

I'm just wondering how SO manages all the tags on here - what does the taxonomy look like?

More generally - I am struggling to decide to normalize the data or not. What is the best practice here?

Thank you,

Edit: I have seen this entry on tagging, but still am unsure which approach is best overall.

share|improve this question

migrated from stackoverflow.com Sep 2 '09 at 17:47

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

marked as duplicate by Jeff Atwood Dec 3 '09 at 17:13

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Take a look at how tags are stored in the data dump.

share|improve this answer

I will assume you are not expecting an answer from Jeff Atwood, so let's speculate:

You will need three tables:

i) a TAG table

ii) a Questions table

iii) a table to implement the TAG-QUESTION relationship that will have (at least) the keys of both tables.

I would never, no matter what performance considerations, think about a non normalized solution for this!.

share|improve this answer
2  
Well, since SO has a hard limit of five tags per question they can probably get rid of the question/tag relation table and store the tags directly in the question table. But in general I agree: Worry about performance if it becomes a problem, not at a point where you having nothing to test and profile yet. – Joey Jun 8 '09 at 22:53
1  
Yes, I don't want to imagine that code checking for the tags on the fields tag1, tag2, tag3... – tekBlues Jun 8 '09 at 23:04
    
No - I wasn't expecting an answer from Jeff necessarily. But one would be nice :). Speculating sounds good to me - I appreciate any insight on the topic. – barfoon Jun 8 '09 at 23:06
1  
+1 - You should definitely worry about normalizing first, and performance second. If performance becomes a problem, having normalized tags is probably not going to hurt when you're trying to optimize... – Tomas Lycken Jun 8 '09 at 23:11
    
Over that, I suppose the SO database to be very manageable, only 180.000 questions (until today) and not so many simultaneous viewers. – tekBlues Jun 8 '09 at 23:35

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