What is the most efficient way to store tags in a database?

后端 未结 7 1201
無奈伤痛
無奈伤痛 2020-11-27 09:06

I am implementing a tagging system on my website similar to one stackoverflow uses, my question is - what is the most effective way to store tags so that they may be searche

7条回答
  •  囚心锁ツ
    2020-11-27 09:37

    If space is going to be an issue, have a 3rd table Tags(Tag_Id, Title) to store the text for the tag and then change your Tags table to be (Tag_Id, Item_Id). Those two values should provide a unique composite primary key as well.

提交回复
热议问题