Introducing Limbo: A complete rewrite of SQLite in Rust
Limbo is Turso's from-scratch rewrite of SQLite in Rust that aims for full language and file-format compatibility, memory safety and a modern architecture. The team chose a rewrite over the libSQL fork because invasive changes such as natural vector-index syntax and async I/O were hard to make in C without SQLite's proprietary test suite. Deterministic Simulation Testing is built in from the start, and Antithesis is used for system-level fault simulation, which has already caught io_uring partial-write bugs. Early results include a fully asynchronous sqlite3_step, a WASM-first build that works with Drizzle, fewer tunables, and a point query about 20% faster than tuned SQLite (506ns vs 620ns).
Related posts
- An adventure in writing compatible systems
Turso mediumAdeptTurso, a Rust rewrite of SQLite, hit a bug where every write after the database crossed 1GB made SQLite's integrity checks fail, even though Turso's own checks found the file intact. The cause was the SQLite "pending byte" page: once a file passes the 1GB mark, SQLite reserves a special page tied to file locking, and Turso did not reserve it. The deterministic simulation tests had missed the bug because every profile injected faults, so no test database ever grew to 1GB. Adding fault-free runs fixed that gap, a reminder that compatible rewrites must match undocumented-feeling quirks of the original implementation.
- Turso v0.7.0
Turso hardMasterTurso 0.7 drops the beta label and focuses on performance and robustness for embedded, multi-tenant use: the core no longer blocks on I/O, yields CPU via a new StepResult::Yield, moves to fallible allocation so OOM surfaces as an error, and treats the page cache as a soft limit like SQLite. The MVCC engine gets a linear-merge dual cursor that replaces per-row skiplist lookups (about a quarter of CPU time on write-heavy loads), watermark-driven garbage collection, experimental passive checkpoints that don't stop the world, and smaller row versions. SQL additions include PostgreSQL-style sequences (now backing AUTOINCREMENT), ICU collations, REINDEX, ordered-set aggregates and window-function groundwork. The SDKs gain a SQLite-compatible .NET/EF Core provider, GIL release and FTS in Python, and concurrent transactions in JavaScript.
- How we used Quint to find over 10 bugs in SQLite while hardening Turso
Turso mediumAdeptModeling individual SQLite C API contracts in Quint, generating small traces, and replaying them as C programs against real SQLite uncovered more than 10 SQLite bugs while also validating Turso's compatible C API. Rather than specifying the whole database, each documented contract was modeled with only the state it needs, so a divergence points either to a model error or to a real bug. One example: sqlite3_deserialize() crashed instead of returning SQLITE_BUSY during an active read transaction. Other findings include wrong results from EXISTS-to-join and UPDATE planning optimizations, xfer optimization bypassing type and CHECK constraints, and mutex alignment undefined behaviour.
- Turso Sync: a much, much, much better way to sync
Turso mediumAdeptTurso, a Rust rewrite of SQLite, replaces libSQL's Embedded Replicas with a sync model built on change data capture, shipping logical changes instead of physical pages and splitting sync into separate push() and pull() operations. Page-based replication wasted bandwidth, could not resolve conflicts (so writes defaulted to the remote), and diverged around checkpoints, forcing re-bootstraps. In Node.js benchmarks against Turso Cloud, Turso sync was 8.9x faster with 16.3x less traffic for 3,000 sequential inserts, 312x faster for read-your-writes cycles with local writes (7.3x even when pushing after every write), and 2.1x faster for an initial pull. Turso also supports partial, lazy bootstrap, and the recommendation is to switch from libSQL sync to Turso.
- How Turso made connections to SQLite databases 575x faster
Turso mediumAdeptSQLite re-reads and parses the sqlite_schema table on every new connection, so opening a connection to a database with 10,000 tables takes about 23ms. Turso, a Rust rewrite of SQLite, parses the schema once and shares it across connections in the same process. It uses Arc::make_mut copy-on-write, so a connection only clones the schema when it changes it inside a transaction, and committed changes propagate to all connections. New connections then open in about 40 microseconds no matter how many tables exist, which is faster even than SQLite's 130 microseconds for a single-table database.