Wednesday, August 28, 2013


I just got back from a FP-Syd (that's Functional Programming Sydney user group) meeting where one of the speakers talked about Datomic. It's basically, in the speaker's own words, "a NoSQL database with a rewind button". Datomic shines where other NoSQL databases have failed:

1. It's fully ACID compliant, which means you can have transactions. What I'm not sure about is whether it does distributed transactions as well. But regardless, I don't know of any other NoSQL database that supports ACID transactions, be they local or distributed.

2. Unlike most NoSQL databases, it actually has a first-class query language based on Datalog which is  itself based on Prolog. Some say it's even more expressive than SQL.

3. Unlike most NoSQL databases, it lets you store data hierarchically and do joins.

4. Out of the box it uses what I believe to be HSQLDB (think SQLite for Java), which allows data to be in memory or on disk. If that doesn't cut it, you can hook it up to a relational database, Riak, CouchBase or Dynamo DB.

5. Clojure is somewhat native to Datomic as it understands Clojure data structures. If you do functional programming in Clojure (or understand Lisp), Datomic is perfect for you as it minimizes if not completely eliminates impedance mismatch.

6. Data is stored as time-based facts, which means that it's append-only. The fact that data is immutable enables things like event sourcing (and with it all the wonderful business scenarios), not to mention avoids a host of concurrency issues that typically plague database systems.

The downsides:

1. It's closed source

2. It costs money if you want to hook it up to other data storages or integrate with memcached