Ways to implement tags - pros and cons of each

后端 未结 5 1667
野趣味
野趣味 2021-01-30 05:33

Related

Using SO as an example, what is the most sensible way to manage tags if you anticipate they will change often?

Way 1: Seriously denormalized (comma delim

5条回答
  •  北海茫月
    2021-01-30 06:15

    Well I have the same doubt I adopted the third solution for my website. I know there is another way for dealing with this problem of variable-length tuples which consists in using columns as rows in this way you will have some information identifying the tuple redudant and the varying ones organized one for each row.

    +--------+-------+-------------------------------------+
    | postId | label | value                               | 
    +--------+-------+-------------------------------------+
    |   1    | tag   |C++                                  |
    +--------+-------+-------------------------------------+
    |   1    | tag   |search                               | 
    +--------+-------+-------------------------------------+
    |   1    | tag   |code                                 |
    +--------+-------+-------------------------------------+
    |   1    | title | Why is a raven like a writing desk? |
    +--------+-------+-------------------------------------+ 
    

    This is really bad but sometimes it's the only feasible solution, and it's very far from the relational approach.

提交回复
热议问题