One for the Treble, Two for the Time
Bitemporal modelling lets an immutable, append-only ledger like TigerBeetle correct past mistakes: record every fact as soon as it is learned, tagged with both a recorded timestamp and an effective timestamp. The recording layer never changes history, and the reporting layer projects what was believed at any point versus what is believed now. A worked example of a mispriced lunch between two people shows how to compute the delta between the two views and post balancing transfers to an Adjustments account. This keeps an append-only audit trail while still fixing errors.
Related posts
- Birth and death of a row in Turso's MVCC
Turso hardMasterTurso's MVCC, modeled on Hekaton, tracks each row as a chain of versions in a lock-free SkipMap, with begin/end fields holding a TxId while a transaction is active and a commit timestamp once it commits. The walkthrough follows one row from the INSERT bytecode executed by the VDBE, through the commit protocol (timestamp acquisition, first-committer-wins conflict checks, dependency waits, logical-log write and fsync), crash recovery by replaying the logical log, and checkpointing into the SQLite WAL and B-tree. Checkpoints default to a blocking Truncate mode triggered at about 4 MB, with an experimental Passive mode that lets writers proceed. Reads merge the in-memory store and the B-tree with a two-pointer iteration. Deletes set the end field under the version-chain lock, so concurrent writers to the same row get a WriteWriteConflict.
- Rediscovering Transaction Processing From History and First Principles
TigerBeetle easyNoviceGeneral-purpose OLTP databases hit a hard throughput ceiling on debit/credit workloads because row locks are held across multiple network round-trips, and hot rows such as a few internal accounts serialize nearly every transaction. Jim Gray's 1985 DebitCredit benchmark anticipated this, defining transaction processing in terms of double-entry bookkeeping. TigerBeetle makes debit/credit a first-class primitive: 128-byte transfers are batched up to 8000 per 1 MiB request, amortizing round-trips and eliminating row locks. It also emphasizes safety through Protocol-Aware Recovery, static memory allocation, 6000+ assertions and deterministic simulation testing. The post doubles as the announcement of a $24M Series A.
- Change Data Capture in SQLite, Without the Triggers
Turso mediumAdeptTurso Database, a Rust rewrite of SQLite, has built-in change data capture enabled with a single PRAGMA. It records every committed insert, update, delete and schema change into a regular `turso_cdc` table with transaction IDs, before/after row images and commit markers, so no triggers or WAL decoding are needed. The post compares this to trigger-based sqlite-cdc, the session extension and update hooks, and lists rough edges: decoding uses the current schema, the change table grows until pruned, and capture is per connection. It ends with a restart-safe polling consumer that groups changes by transaction, advances a watermark only at transaction boundaries, needs an idempotent apply step and prunes against the slowest consumer.
- Introducing Change Data Capture for SQLite in Turso
Turso mediumAdeptTurso's SQLite rewrite gains an unstable, built-in Change Data Capture feature enabled per connection via PRAGMA unstable_capture_data_changes_conn. The pragma logs every insert, update and delete into a regular turso_cdc table with change type, rowid and binary before/after row images, and JSON helper functions decode those images. Four modes (id, before, after, full) trade detail against storage. Decoding uses the current schema, so dropped or added columns can corrupt historical records unless schema versions are tracked manually. Release v0.1.2 also adds Euclidean vector distance, new language bindings, B-tree lookup optimizations and fault-injection and Antithesis testing.
- The Write Last, Read First Rule
TigerBeetle mediumAdeptWhen an application spans two stores without a shared transaction boundary, such as Postgres for account master data and TigerBeetle for the ledger, one must be designated the system of record and the other the system of reference. Writes go to the system of reference first and the system of record last, and existence checks read the system of record first. This keeps the system traceable: no funded ledger account ever lacks an owner record, even if it is temporarily inconsistent. The approach is implemented with Resonate's durable execution (Distributed Async Await) and idempotent per-store create functions. A result matrix classifies outcomes as success, recovery, conflict or ordering violation, and the application panics to alert an operator on violations.