datomic-essentials
A series of Datomic introduction articles, using SQL to explain certain abstract ideas
Datomic: A Database with Built-in Event Sourcing
Once, I came across a story shared by a teacher who taught DDD (domain-driven design). He mentioned that after conducting a course on event sourcing, some participants told him, “Teacher, this event sourcing thing... it seems hard to apply in practice.”
There are other similar stories. During my time at a particular organization, I asked some colleagues if they had ever implemented event sourcing. One colleague replied, “Yes, but that project ended in disaster. Someone even got so frustrated that he quitted.”
Strangely enough, when I use event sourcing, it works perfectly fine—no difficulties at all.
You might thi…
datomic-essentials
A series of Datomic introduction articles, using SQL to explain certain abstract ideas
Datomic: A Database with Built-in Event Sourcing
Once, I came across a story shared by a teacher who taught DDD (domain-driven design). He mentioned that after conducting a course on event sourcing, some participants told him, “Teacher, this event sourcing thing... it seems hard to apply in practice.”
There are other similar stories. During my time at a particular organization, I asked some colleagues if they had ever implemented event sourcing. One colleague replied, “Yes, but that project ended in disaster. Someone even got so frustrated that he quitted.”
Strangely enough, when I use event sourcing, it works perfectly fine—no difficulties at all.
You might think I’m about to tell you that I’m some kind of 10x engineer. That’s not the case. What I’m really here to share is my secret: I use a database with built-in event sourcing—Datomic.
Acknowledgments
The completion of this article series is largely inspired by my work at Gaiwan and LambdaIsland. Additionally, while attending Heart of Clojure, I learned that non-Chinese readers were also interested, so I translated the original Traditional Chinese version into English.
If you have any thoughts after reading this series, feel free to reach out to me.
Table of Contents
-
Event Sourcing
-
OLTP
-
Advantages
-
Implementation Challenges
-
Inability to Rewind Database State
-
String-Based Query Languages
-
Locking and Isolation Issues
-
Schemas Are Hard to Query
-
Rigid and Fixed Schemas
-
Impedance Mismatch
-
The Clojure Language
-
Learn Datalog Today
-
Datomic’s Information Model
-
Basic Datalog Queries
-
Multiple Data Patterns Sharing a Variable
-
Multiple Data Patterns with Multiple Variables
-
Parameterized Queries in Datalog
-
Binding Forms in Datalog
-
Querying Attributes
-
Querying Transactions
-
Using Datalog to Perform Various SQL Joins
-
Starting with Datalog – Part 8 (Predicates and Transformation Functions)
-
Five Types of Clauses
-
Predicate Expressions
-
Function Expressions
-
Runtime Environment
-
Starting with Datalog – Part 9 (Aggregates and the With Clause)
-
Built-in Aggregate Functions in Datalog
-
The With Clause
-
The Four Common Find Specifications in Datalog
-
Using Datalog Rules
-
Characteristics of Rules
-
Cross-Database Queries in Datalog
-
Top N per Group
-
Recursive Queries
-
All Attributes
-
Reverse Queries
-
Common Solutions
-
Analyzing the Impedance
-
Datomic’s Solution
-
Code and Data Examples
-
Database Filters
-
No Need for NULL Values
-
Shared Column Schema
-
No Need for Bridge Tables
-
Defining a Schema
-
Data Types for
-
Writing Actual Data
-
Format of Transaction Data ()
-
Unique Transaction Semantics in Datomic
-
Datomic Makes the Primary Key Decision for You
-
Enum Types and
-
Common Applications
-
Advanced Applications
-
Internal Structure of Indexes
-
Guidelines
-
Measurement Tools
-
Direct Access to Datomic’s Indexes
-
For OLAP Queries, Use Change Data Capture (CDC)
-
Event Sourcing
-
Highly Expressive Query Language
-
Unique Distributed Architecture
-
Conclusion
License
Copyright @ Laurence Chen
Licensed under the term of the Creative Commons Attribution 4.0 International License.