Is there an agreed ideal schema for tagging

前端 未结 7 1398
名媛妹妹
名媛妹妹 2020-12-22 20:31

I have a photo website and i want to support tags as my original category bucketing is starting to fail (some pictures are family and vacations, or school and friends). Is

7条回答
  •  甜味超标
    2020-12-22 20:59

    if you want real performance with millions of records, you could store tags in one field, comma separated and retreive records with a full-text index/search daemon like sphinxsearch. All you have to add, is a table listing all tags with a count value to know how often they are attached to an item.

    I know it's not the usual way and a little more complicated than a pure database solution, but it's really really fast to search tag related items.

    You could use full-text search fonctionnality of your database engine too, but when there's lots of records, most engines tend to be slow.

    If it's for a small project, you can go your way, seams good and proper way to do. But I would just share with you this other solution. What do you think of ?

提交回复
热议问题