Rationale

Datomic is designed to apply Moseley and Marks' complexity-eliminating approach in Out of the Tar Pit to the database. Traditional systems architecture the database as a monolithic, mutable place, separate from the program. This creates accidental complexity of state that lives “over there”. Datomic avoids this complexity with three major design features.

Immutable database values

Most databases handle novelty with an update-in-place model. This blinds our programs to past states and keeps us from programming declaratively or functionally, because a database that changes underneath your query is an unstable basis for decision-making.

Datomic instead leverages immutable database values, separating the identity of the database from the states it has over time. This epochal state model makes prior values available because new facts are accreted, not replaced. Like tree rings, each database value is a consistent view of state at that particular point in time. Auditing, debugging issues caused by transient state, and functional programming against the database all become trivial.

Information model of facts

The poor granularity of relational tables conflicts with Datomic’s epochal state model. For this reason, Datomic uses an information model based on atomic facts, akin to RDF plus a time component: entity/attribute/value/transaction.

By removing rigid rectangular structure and adopting a universal schema — defining only the properties of attributes, not which entities they belong to — Datomic gains the flexibility to efficiently represent sparse, irregular, graph and hierarchical data.

Perception without coordination

Immutability and a fact-based information model allow Datomic to separate perception (queries and event sourcing) from the processing of novel facts.

Monolithic databases answer queries and transact new data on the same machine, meaning queries and mutations contend with each other. Datomic’s “deconstructed” architecture instead splits the database into

  • a novelty-processing component,

  • n>=1 components which handle queries, and

  • a storage service

This makes Datomic a middle ground between eventually consistent and monolithic systems, able to maintain consistency alongside the elasticity, redundancy, availability, and scalability of modern distributed key/value stores. Change is reified as first-class transactions which support truly reactive event-driven systems, with no polling necessary.


Learn more

For a deep dive on Datomic’s technical approach, see the Overview docs.