Search code examples
nosqlkey-valuekey-value-store

What are the uses of a key-value database?


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?


Solution

  • 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...