CouchDB: Thinking beyond the RDBMS

A flat document storage engine calling itself a database? On any other day, that’s what you’ll get from a collaboration between a vendor and PR agency, pushing new ways to achieve synergy and optimize the bottom line to Global 5000 companies.

This day, it happens to be CouchDB. And CouchDB on first look seems like the future of database without the weight that is SQL and write consistency.

It stores document in a flat space.

There are no schemas. But you do store (and retrieve) JSON objects. Cool kids rejoice.

And all this happens using Real REST (you know, the one with PUT, DELETE and no envelopes to hide stuff), so it doesn’t matter that CouchDB is implemented in Erlang. (In fact, Erlang is a feature)

Here’s where it gets interesting. There are no indexes. So your first option is knowing the name of the document you want to retrieve. The second is referencing it from another document. And remember, it’s JSON in/JSON out, with REST access all around, so relative URLs and you’re fine.

But that still doesn’t explain the lack of indexes. CouchDB has something better. It calls them views, but in fact those are computed tables. Computed using JavaScript. So you feed (reminder: JSON over REST) it a set of functions, and you get a set of queries for computed results coming out of these functions.

Here’s the kicker. This simple architecture you can partition and replicate any way you want, map/reduce these computed tables on any scale, and deal with the rest on the client.

And if you’re using a sane person’s programming language, it’s a trivial matter.

I’m personally convinced that write consistency is the reason RDBMS are imploding under their own weight. Features like referential integrity, constraints and atomic updates are really important in the client-server world, but irrelevant in a world of services.

You can do all of that in the service. And you can do better if you replace write consistency with read consistency, making allowances for asynchronous updates, and using functional programming in your code instead of delegating to SQL.

It’s an incredibly hard problem to solve in languages like C or Java, but we’re past that stage, and it’s time to start looking beyond SQL.

So CouchDB is still an alpha, but a serious project to look at.

Ruby bindings here, and another take on CouchDB from Tobi.

Update: For more context: Read Consistency: Dumb Databases, Smart Services

16 thoughts on “CouchDB: Thinking beyond the RDBMS

  1. Actually, I’m a little disappointed in the briefness of the CouchDb summary. I’m not a big fan of RDBMSs either, especially since so many keep some of their business logic in SQL (via stored procedures) and some in the service code (C#, Java, whatever). Ughh… The prospect of using various functional programming paradigms is very attractive.

    But it isn’t clear from what I’ve read that CouchDB provides the functionality that is commonly included with your average RDBMS, particularly the extensive join capability, cascading deletes, etc. SQL is ugly, but it is very expressive in its domain. I’d sure like to see an example of how CouchDB clients handle these questions. I’d be real reluctant to re-implement an SQL-like interpreter in Java, C#, Lisp or Scheme without good reason.

  2. I think the future is running joins on the client. Not to be confused with indexing and filtering which are horribly expensive on the client in terms of performance. Joining on the client gives you partitioning across data sources, you can pull data from all over the place, local and remote services, etc And the possibilities, when you run the queries outside the database are endless.

    With that in mind, the idea that a database server provides query capabilities is wrong. You should be able to pick a generic library that works best for your environment, and use it with any number of data sources.

  3. Pingback: links for 2007-09-04 « Treat with Jermolene

  4. Pingback: All in a days work…

  5. Pingback: tecosystems » links for 2007-09-05

  6. Pingback: items for 09.08.2007 « Tzetze Fly

  7. Pingback: CouchDB - doucument centric ODS « Gobán Saor

  8. Seems like Notes dB. A notes database is very good for document type storage and this dB seems to have very similar concepts (replication, document id, etc.)

  9. Pingback: links for 2007-09-17 » SDLC Blog

  10. As a database developer in MSSQL I have to say that this look very interesting. I’m looking forward to see it in action. I’m just installing it on my laptop.

  11. Can you say Lotus Domino? I find it hilarious that this is seen as such a hot thing when its basically reimplementation of what Lotus Domino has been doing since the 80s. Say Lotus Domino and people laugh and think its a toy but this is somehow revolutionary and progressive? Don’t get me wrong I think its great, as is Lotus Domino for specific purposes.

  12. Pingback: Perspectives

  13. Pingback: Perspectives

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>