Datomic

Datomic is a proprietary database management system. It is an operational DBMS, in other words, it allows updates in real time. Instead of assigning and overwriting values into named attributes, Datomic keeps track of all immutable facts over time, which sets Datomic apart because previous states can be accessed at any time. Datomic is also a distributional DBMS, which provides horizontal read scalability. There are two Datomic products, Datomic Cloud and Datomic On-Prem. Datomic Cloud is built for AWS integration, and Datomic On-Prem (On-Premise) could be built on any infrastructure and storage services.

History

Early March 2012, the Relevance team (later joined with Metadata to form Cognitect) around Rich Hickey released Datomic, which they have started to work on since 2010. To make better use of recent advancements in cloud computing, Datomic Cloud was release in early 2018, which utilized and integrated AWS technologies, for example, - DynamoDB, EFS, EBS and S3 as storage services; - CloudFormation for deployment; - AWS Cloudwatch for logging, monitoring, and metrics. Since the release of Datomic Cloud, the original Datomic was referred to as Datomic On-Prem (On-Premise) to distinguish from the new release.

Query Interface

Datalog

Datomic's query interface is an extension from Datalog. The main difference is that Datalog systems usually have a global fact database and a set of rules, but Datomic Datalog could take multiple databases and sets of rules.

Concurrency Control

Optimistic Concurrency Control (OCC)

Datomic supports optimistic concurrency control, which is made possible by its built-in compare-and-swap `:db/cas`.

Storage Model

Custom

Datomic treats storage as a service, which means that Datomic only provides the ways to access underlying storage, but doesn't provide the actual storage. Storage services could also be switched easily by simply [changing the connection string](https://docs.datomic.com/on-prem/storage.html#storage-services).

Isolation Levels

Serializable

There is only one thread responsible for writing transactions, so transactions are always serializable.

Stored Procedures

Supported

Stored procedures are represented as [transaction functions](https://docs.datomic.com/on-prem/database-functions.html#transaction-functions) in Datomic, which can be invoked during transaction processes.

Indexes

B+Tree

Datomic indexes are covering indexes. In other words, instead of storing reference to data in the index, Datomic directly reads data from index. The index trees are shallow, with at most 3 levels: root, directories and segment leaf. Datomic maintains four index trees with different sorting orders for efficient access of different queries.

Storage Architecture

Hybrid

Foreign Keys

Supported

Foreign keys can be defined using `:db.type/ref` attribute, but no foreign key constraints are enforced on them automatically. User needs to specify their own database functions to impose those constraints.

Data Model

Relational Key/Value Entity-Attribute-Value

Datomic stores immutable facts as datoms over time. A datom follows the form of `(entity, attribute, value, time).` Although Datomic doesn't require a table schema that specifies attribute columns in advance, it requires to specify properties of individual attributes. This is called universal schema.

System Architecture

Shared-Disk

A Datomic system consists of a computing stack, a set of storage services, and an optional query group. The computing stack could have multiple computational units for Datomic system called nodes. Each node has its own low-latency cache, transactions, and queries.

Compression

Naïve (Record-Level)

Index trees contain "segments," arrays of records that are serialized and then compressed with zip. Compression allows more efficient caching and storage.

Datomic Logo
Website

https://www.datomic.com/

Tech Docs

https://docs.datomic.com/

Developer

Cognitect, Inc.

Country of Origin

US

Start Year

2012

Project Type

Commercial

Written in

Clojure

Supported languages

Clojure, Java

Operating Systems

All OS with Java VM, Hosted

Licenses

Proprietary

Wikipedia

https://en.wikipedia.org/wiki/Datomic