Birth and death of a row in Turso's MVCC
Turso'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.
Related posts
- Turso v0.5.0
Turso hardMasterTurso v0.5.0 promotes MVCC-based concurrent writes (BEGIN CONCURRENT, adapted from Hekaton) to beta. The MVCC work adds commit dependency tracking, a rewritten crash-safe logical log, low-watermark garbage collection, savepoints, hardened conflict detection and lock-free rowid allocation, verified with Antithesis, Hermitage and Elle. The release also adds experimental Tantivy-based full-text search stored inside the SQLite B-tree, and optimizer upgrades: hash joins with bloom filters, outer joins and disk spilling, semi/anti-join decorrelation, multi-index OR scans and a reworked cost model. Rounding it out are STRICT tables with user-defined types via CREATE TYPE, and stable change data capture with a v2 transaction-grouped record format.
- Beyond the Single-Writer Limitation with Turso's Concurrent Writes
Turso hardMasterTurso implements SQLite-compatible BEGIN CONCURRENT using Hekaton-style MVCC, which removes SQLite's single-writer bottleneck and the SQLITE_BUSY errors that come with it. An in-memory row-version index sits on top of the B-tree and WAL, conflicts are detected per row at commit time instead of per page, and the MVCC log is checkpointed back into the database file through the WAL. In benchmarks SQLite still wins single-threaded, but Turso is 16% faster with multiple threads and pure inserts, and 4x faster with 8 threads and 1ms of compute per transaction. The feature is an early tech preview: CREATE INDEX is not supported and full-row versioning carries a high memory cost.
- Turso v0.4.0
Turso mediumAdeptTurso v0.4.0 overhauls its experimental MVCC mode, which lifts SQLite's single-writer limit, adding index support, checkpointing and recovery. MVCC is now enabled with `PRAGMA journal_mode = 'experimental_mvcc'`, persisted in the file header, and makes the file unreadable by stock SQLite until you switch back to WAL. Partial sync fetches pages on demand, with bootstrap queries and prefetching (persistent mode is Linux-only because it needs sparse files), and sync now ships in the Python and Go SDKs. The release also adds page cache spilling for large queries, ANALYZE support for better join ordering, and a disk-spilling hash join for non-indexed columns in place of SQLite's ephemeral B-tree indexes.
- SQLite Concurrent Writes Are Here: Early Preview on Turso Cloud
Turso mediumAdeptTurso Cloud now offers concurrent writes in early preview: transactions opened with BEGIN CONCURRENT run optimistically in parallel on an MVCC engine modeled on Microsoft's Hekaton, with conflicts detected at commit time at row granularity. Unlike SQLite's single-writer WAL model (SQLITE_BUSY at transaction start) or its unmerged BEGIN CONCURRENT branch (page-level conflicts that produce false collisions), writes to unrelated rows on the same B-tree page no longer conflict. Retry logic is still needed for genuine same-row conflicts, which hot-row workloads will hit often. To use it, enable the feature in the dashboard, create a tursodb database, and issue BEGIN CONCURRENT, with examples shown for the TypeScript, Rust and Python clients.
- Concurrent Writes in Practice: Building High-Throughput Apps with Turso's MVCC
Turso mediumAdeptTurso's BEGIN CONCURRENT replaces SQLite's single-writer lock with Hekaton-inspired optimistic MVCC that detects conflicts at commit time and at row granularity, rather than the page-level detection in SQLite's unmerged experimental branch. Turso's benchmarks show write transactions running 4x faster than SQLite at 8 threads with 1ms of compute per transaction, and 16% faster with no compute. The biggest gains come from transactions that read, compute, then write, from ingestion across distinct rows, and from long-running augmentation jobs. Practical use on Turso Cloud requires opting in and creating a tursodb database, with working TypeScript, Python and Rust code for concurrent transactions and bounded exponential-backoff retry wrappers for write-write conflicts.