datalevin

datalevin/datalevin

A simple, fast and versatile Datalog database

1.4k
Stars
82
Forks
26
Open issues
24
Watchers
Clojure EPL-2.0Last pushed Jul 7, 2026

Overview

Datalevin is a durable Datalog database designed to provide a simple and efficient query engine for developers.

Categories

Tags

Similar tools

Install

git clone https://github.com/datalevin/datalevin

README

Datalevin

🧘 Simple, fast and versatile Datalog database for everyone 💽

datalevin-java on maven central datalevin-node on npm datalevin on pypi datalevin on clojars bb compatible

datalevin-java javadocs datalevin on
cljdoc

I love Datalog, why hasn't everyone used this already?

Datalevin (/ˈdadə ˈlevən/, "levin" means "lightning") is a simple durable Datalog database. Here's what a Datalog query looks like in Datalevin:

(d/q '[:find  ?name ?total
       :in    $ ?year
       :where [?sales :sales/year ?year]
              [?sales :sales/total ?total]
              [?sales :sales/customer ?customer]
              [?customer :customers/name ?name]]
      (d/db conn) 2024)

:question: Why

The rationale is to have a simple, fast, versatile and open source Datalog query engine running on durable storage.

It is our observation that many developers prefer the flavor of Datalog popularized by Datomic® over any flavor of SQL, once they get to use it. Perhaps it is because Datalog is more declarative and composable than SQL, e.g. the automatic implicit joins seem to be its killer feature. In addition, the recursive rules feature of Datalog makes it suitable for graph queries and deductive reasoning.

The feature set of Datomic® may not be a good fit for some use cases. One thing that may confuse some users is its temporal features. To keep things simple and familiar, Datalevin behaves the same way as most other databases: when data are deleted, they are gone. Datalevin also follows the widely accepted principles of ACID, instead of introducing unusual semantics.

In addition to support Datomic® flavor of Datalog query language, Datalevin has a novel cost-based query optimizer with a much better query performance, which is competitive with SQL RDBMS such as PostgreSQL and graph databases such as Neo4j.

Datalevin provides robust ACID transaction features on the basis of our fork of LMDB, known for its high read performance. With built-in support for WAL and asynchronous transaction, Datalevin can also handle write intensive workload.

Datalevin can store large document (< 2 GiB) and automatically build index by paths for JSON, EDN and Markdown