Posts tagged: database

Relaxing On the Couch

By David Hollingworth, 26/09/2009 9:01 pm

 

For the last few weeks I’ve been spending some time relaxing on the couch. Well that’s actually working with the Apache Couch DB database.

Most of my career in IT has been spent working with relational databases, principally Oracle and Informix and more recently MySQL. Couch DB represents a bit of a departure from this area in that Couch DB is a document database. Instead of being stored in normalised tables or rows and columns all related data in Couch DB is stored together in JSON format documents. Instead of writing SQL queries to access data you use view constructs written in JavaScript and stored is special design documents. Creating a view creates a btree index in the database and allows very fast access to the relevant documents.

Couch DB utilizes a RESTful interface and so is unsuitable for things like banking applications that need transaction concurrency. However it’s great for things like blogs and other text based applications. Instead of row level locking present in relational databases Couch DB employs Multi-Version Concurrency Control (MVCC). What this means in practise is that users each get a consistent snapshot of a document without having to wait for other users to release locks on a document.

The database itself is still fairly young and the API is open to change as it matures. There’s a variety of language libraries also available; but some of these are also a bit immature and some lack some basic functionality or are difficult to implement. To avoid reliance on third parties and to be able to react quickly to changes in the database API I’ve been using the Couch DB JavaScript class library and have found this perfectly adequate for the prototype and proof of concept work I’ve been doing to date.

So far I haven’t written anything earth shattering to be worth sharing any code. So instead I thought I’d just list some of the excellent resources and tutorials I’ve referenced over the last couple of weeks:

There’s probably been others, I’ll add them in as I come across them; but for now… relax!

 

 

Panorama Theme by Themocracy