53

I'm very much inspired by the approach to data management advocated by Rich Hickey, and implemented in Datomic, where the data is never mutated in-place, all the versions are always preserved and query-able, and the time is a first-class concept.

Of course, there are specialized databases matching that description, like Git, or any other source control system. The question is if there are any (more or less) general-purpose DBMS-es of relational, graph, hierarchical, document or any other flavor that can be effectively used in, say, an eCommerce Web application. Or is Datomic the only choice then?

10
  • 2
    I think both the BerkeleyDB Java Edition and CouchDB work like that internally. But in both cases, there are "space reclaim" processes that purge old data and I am not sure if the history is really exposed as a first-class concept (as opposed to "just" being used to make transaction isolation work).
    – Thilo
    Commented Nov 22, 2012 at 8:02
  • 1
    That's right. I'm using CouchDB right now. The views' map-reduce functions can't access the old versions. Commented Nov 22, 2012 at 8:05
  • 2
    Noms is versioned, forkable, syncable, append-only database. It is possible to see the entire history of the database Commented Oct 27, 2016 at 9:44
  • 1
    There's also Bigtable
    – Adzz
    Commented Feb 15, 2017 at 19:39
  • 1
    LiteTree SQLite with Branches Commented Aug 29, 2018 at 17:07

2 Answers 2

35

There is an approach to designing systems with an idea of never deleting or mutating data called Event Sourcing. Basically, the idea is to store events (or facts) that change the system state, instead of snapshots of the state. The history of events can be replayed later on to produce a certain purpose-specific projection of what the state at any point in time looked like. Multiple projections built for different purposes can coexist in the system. More information can found on the following web sites:

It's in line with what you are describing, but rather than being just a database model, Event Sourcing and Command Query Responsibility Segregation (CQRS) prescribe a special way of designing the whole system including the database and business logic layers.

There are a few frameworks that follow this approach, such as:

While this does not directly answer your question, it may provide a different perspective on the problem.

5
  • 1
    No worries, I'm glad it's useful! Commented Nov 22, 2012 at 13:08
  • 2
    Another great article I've found myself is this: nathanmarz.com/blog/how-to-beat-the-cap-theorem.html – Describes a general strategy for storing and querying immutable facts, splitting the data storage into two layers: batch and realtime. Comments are also quite interesting. The author is even writing a book on this topic now: manning.com/marz Commented Jan 23, 2013 at 8:59
  • Are these still relational? In heaven I think there's some sort of prolog/sql aka rule-based/relational, immutable database in JavaScript that can run on the client and server (like PouchDB & CouchDB or Meteor). I send it a transaction, and get a callback on successful (consistency) or collision (simultaneous writes) -- and it does JOINs! But, unfortunately, only in heaven... :P It's a lot to ask for, I know. Commented Jun 8, 2015 at 22:35
  • There is very good description of event sourcing. Commented Mar 29, 2016 at 15:15
  • Event store is open-source, functional database with Complex Event Processing in JavaScript. if needed idea realized for JavaScript. Commented Jun 27, 2016 at 17:28
7

Irmin is a distributed database that follows the same design principles as Git.

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.