键值数据库有什么用途?
我听说过高度可扩展的键值数据库,例如 Amazon DynamoDB 和 京都内阁。
但我看不出它对解决日常问题有何用处。
例如:假设我有一个“帖子对象”,它有一个 id、一个标题、一个内容和一些标签,我想查询数据库以查找带有某个特定标签的所有帖子。如何使用键值数据库来做到这一点?
I've heard about highly scalable key-value databases, like Amazon DynamoDB and Kyoto Cabinet.
But I can't see an use for everyday problems.
Ex.: Suppose I have a "post object", which has an id, a title, a content and some tags, and I want to query the database to find all posts with some particular tag. How can I do it with a key-value database?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
键值存储速度极快(通常在内存中)并提供最终一致性。许多标准数据库功能(例如 ACID)可能不存在,但同时也不存在诸如过多写入等限制。
这个想法是像在哈希表中那样在传统的键值存储之外进行思考,而是将这种形式的存储视为一种非规范化的存储形式,该存储形式是根据您想要触发的查询而设计的。
在您的具体问题中,我将使用标签作为键,使用帖子 ID 作为值。然后宾果...
Key value stores are extremely fast (typically in memory) and provide eventual consistency. Many of the standard database features such as ACID may not exist but at the same time none of the limitations such as too many writes etc., also exist.
The idea is to think outside of the traditional key-value store as you would do in a hashtable and instead look at this form of storage as a de-normalized form of storage that is designed based on the queries you want to fire at it.
In your specific question I would use the tags as keys and the post-id as values. Then bingo...