4 ms·
Ask HN: What are the killer use cases for key-value stores?
So, I understand that key-value stores are the new hotness (CouchDB, Tokyo Cabinet, the venerable BerkelyDB). But, I'm still looking for a good use case for using them in a web app.
I understand that something like a personal blog is well suited to a key-value store. There aren't many relational queries that you'd have to run. It's just a series of documents and titles, and you only have one person posting to the blog.
But, as soon as you have more than one table's worth of data, don't key value stores start to fall apart as a solution? As soon as you add a second user model to your web app, or add tags to your personal blog model, you have to start doing a lot more programming to get around those problems.
I'd love to hear from someone using a key-value store for web apps. How do you get around this? I'd also love to hear what the killer use cases for key-value stores are. I'd love to play around with them, but everything I can come up with, it seems like a database is a better fit.
- dantheman 17y agoI'm only really familiar with couchdb, and implementing things like tagging are very easy. Couchdb is document based with incremental map/reduce. So for blog tagging, you have a blog document. That has an array of tags or even just the tags on the string. To be able to pull up documents based on tags you can write a view that will execute map/reduce to create a list of tags and the documenets the implement them. So document structure would look like { blogtext: my blog text" tags: ["tag1", "tag2"] } The map function looks like: function (doc) { for each (tag in doc.tags) { emit (tag, doc._id) } } That will generate a list of keys and the document ids that match. So when you execute: http://server/db/desgindoc/_view/tags?key=tag1 http://server/db/desgindoc/_view/tags?key=tag1 you' recieve all of the documents matching that tag. You can of course do more advanced tagging, but this was just a simple example.
- lacker 17y agoThe killer use case is when your traffic is large enough that you have to shard across many machines.