Skip to content

Datomic For The 96 Percent

Dustin Getz edited this page Nov 8, 2018 · 6 revisions


Traditional SQL databases have great power, via ACID transactions and via a declarative, logic-based query language (SQL). But SQL databases encounter problems on the web:

  • SQL databases have a rigid information model, and typically a rigid deployment model. This rigidity creates impedance mismatches both with development languages and with emerging cloud strategies.

  • SQL databases are update-in-place, and forget the history of your data.

  • SQL databases struggle with the extremely high write and/or data volumes that characterize the largest four percent of databases.

Much of the effort of the NoSQL movement has gone to solve the third problem, the problem of the four percent, under the mantra "web scale". Datomic solves the first two problems -- with a flexible information model and a deployment model suited to the dynamic web, and to the cloud.

Datomic is for the ninety-six percent.

What We Will Cover

Datomic's information model is based on a universal relation, and an entity abstraction over that relation. The universal relation eliminates the join keys and join tables imposed by SQL's plethora of specific relations, making queries easier to write, read, and understand. Entities expose the universal relation as associative collections, which correspond directly to the navigable, associative style of OO, eliminating the impedance mismatch and the need for libraries such as ActiveRecord and Hibernate.

Datomic stores information immutably, and remembers the past. This has two key benefits:

  • You can query as-of now, or as-of other points in time, or across a range of time.
  • The database is an immutable, distributed, cache-friendly value that can be queried locally from any peer process. Queries run "over here", in your application process space, not "over there" in a special database process. As a result, query scales horizontally.

Datomic's deployment model is designed for a virtualized world. All components of the system are designed from the ground up to be ephemeral. More importantly, Datomic treats storage as a separate service. You can store your data on the local filesystem during development, and upgrade to using a SQL database for storage for production. When you are ready for the cloud, you can store your data in a distributed storage such as Amazon's DynamoDB, CouchBase, or Riak.

Datomic's flexibility comes with the expressive power you know and love in SQL databases. Where the four percent need "web scale", and the complex programming model imposed by eventual consistency, most programs would be better off with the traditional values: ACID transactions and powerful queries. Datomic gives you these in spades: transactions always run at the highest isolation level (serialized), and the Datalog query language has greater expressive power than the relational algebra at the foundation of SQL.

If you are among the ninety-six percent, and manage transactional data of record on the web, Datomic may be a good fit for you.


You can’t perform that action at this time.