Significant development time can be spent with databases. Database design can be a tricky subject, as normalization is desired, but too much normalization can create complex, expensive queries that are a headache to debug and bog down the system. On top of these traditional relational database, many applications are now built in object oriented languages and utilize object relational mapping to interface between the database and the application. This creates another layer of complexity that must be designed and developed.
This may be fine when developing enterprise applications with large teams and budgets, but with smaller teams, all of this can be hassle that can be avoided largely with the careful use of key-value store. There are many great options available including Project Voldemort, Cassandra, and CouchDB. An overview of some key-value stores may be found here. The rest of this post will deal specifically with CouchDB, though many of the concepts may be ported to other similar databases.
CouchDB is a schema-free document-oriented database. Documents are stored and fetched by their key using a REST API. More complex information may be retrieved using views, though these still have limited functionality and can be expensive to create and update. Data is passed using JSON which provides a lightweight structure that can be easily used by applications in many languages.
With a key-value store such as CouchDB, objects can be saved directly to the database without worrying about mapping object oriented data to relational database tables. This takes an entire level of complexity off of the application and allows the developer to focus on modelling the problem domain without worrying about how the model will interact with a relational model database.
As with any system, there are drawbacks to using a database like CouchDB. First of all, when using a key-value store, object design is of critical importance. There is no database schema to fall back on with CouchDB and no validation rules (such as foreign keys.) All validation must be handled by the application (either by the objects themselves or by a database wrapper.)
Finally, key-value stores are best suited for applications where most of the data can be de-normalized and accessed via a primary key. While views in CouchDB can solve some querying complexity, they should be used judiciously.
Key-value stores like CouchDB cannot solve every problem, but they do provide an elegant solution to some applications and can significantly reduce database development time allowing developers to focus on solving the problem at hand.





Jan
Hey,
thanks for the nice write-up. I’d just like to add, that CouchDB can do optional schema validation: http://jchrisa.net/drl/_design/sofa/_show/post/couchdb_edge__security_and_vali
Cheers
Jan
–
Zach
Thanks for the addendum. I remember reading about that now, but haven’t used it yet.
Launch Box » Posts » Examples of CouchDB Usage
[...] to the local PHP group on CouchDB. For some background information, see my previous blog post about CouchDB and key-value data stores. Today I would like to provide a little more information on CouchDB along with a few [...]