0

I have dealt with tags systems before in MySql for a simple blog with a Tag table, a TagMap table and a Post table, but in my mind this is a very convoluted way of storing tags and relating them to posts. The query for getting posts by tag was equally convoluted.

Now that I am doing a project in Node.js, I am looking for a new way to store my data and a new database system. I have looked into CouchDB, but it seems to have problems searching for multiple tags and the concept of views seems too complicated for what I am trying to accomplish.

Is there a database system, preferably one that has a library/client out for node.js, that is efficient and that makes the whole tagging-ordeal seem intuitive?

4

2 回答 2

2

在这种情况下,我认为您不会比关系数据库做得更好。

如果您需要标签同义词,请在此处查看一些想法(但请注意,由于 MySQL 查询优化器的缺陷,应将 EXISTS 重写为另一个 JOIN)。没有同义词,这个模型可以进一步简化。

重要的一点是,使用诸如集群覆盖之类的技术应该为除了绝对大量的数据和并发用户之外的任何事物提供充足的性能。人们似乎犯的一个错误是在标签映射表中使用代理键,这会破坏集群。

于 2012-07-17T23:49:34.357 回答
0

Redis 集在这里可能会很好地工作:创建一个由标签或标签 ID 组成的帖子 ID 键控的集合,以及一个由帖子 ID 组成的标签(或标签 ID)键控的集合。然后就可以使用redis内置的集合交集和并集操作符,基于多个标签进行快速搜索。

于 2012-07-18T02:29:07.907 回答