The engine
A serious database in a single file — every claim below ships today in the open-source crate.
header pages#v126 pages#v127 pages#v128 append →
SQL & schema
- Broad dialect
- JOIN, GROUP BY/HAVING, DISTINCT, aggregates (incl. GROUP_CONCAT), subqueries, CTEs (WITH), UNION, CASE, CAST, BETWEEN, ||, plus a scalar and date/time function library.
- Views & triggers
- CREATE VIEW; row-level BEFORE/AFTER triggers on INSERT/UPDATE/DELETE with OLD/NEW.
- Integrity
- Foreign keys with ON DELETE RESTRICT, CASCADE and SET NULL.
- Logical ALTER TABLE
- ADD, DROP, RENAME, MOVE and REORDER COLUMN without rewriting a single row — and time-travel-safe.
- Secondary indexes
- B-tree CREATE [UNIQUE] INDEX; the planner uses them for equality, ranges and multi-column lookups, with deterministic predicate pushdown in JOINs.
Search
- Full-text, native
- MATCH with BM25 ranking, snippet() and highlight(), index-accelerated. Prefix-compressed posting lists keep the index below SQLite FTS5.
- Vector / semantic
- f32 and int8 vector columns; exact KNN plus ANN via CREATE VECTOR INDEX … USING cosine|l2 (IVF / IVF-PQ); hybrid RRF combines BM25 and vectors. The index is ≈10–20× smaller than HNSW.
- Time-travel search
- MATCH … AS OF queries the past — something no dedicated search engine offers.
- Index builds that scale
- Parallel (k-means, assignment and PQ across all cores) and streaming — the dataset is never materialized, so tens of millions of rows fit on a modest box.
Storage & speed
- The file is the WAL
- Append-only copy-on-write B-tree. One file per tenant: backup is cp, restore is cp.
- Durability
- ACID with tail-scan recovery and a single fsync per commit. Group commit batches concurrent committers — about 4.6× durable throughput at 16 threads.
- Bulk loads
- bulk_insert runs the whole batch in one transaction with no per-row executor — 2.5M rows/s on our benches.
- Streaming reads
- Simple SELECTs stream with lazy decode: only the projected columns, straight from the page. The typed engine API serves point lookups ~3.7× faster than the SQL path.
- Concurrency
- Concurrent readers with no global lock — every read is an immutable snapshot.
Integrity & crypto
- Hash-chained history
- Every commit is chained with SHA-256; tampering with the past is detectable. verify() with anchors proves the file untouched.
- Encryption at rest
- AES-256-GCM per page (optional) — PII never touches the disk in the clear.
- Self-healing
- Reed–Solomon per page (optional) corrects bit-rot instead of just detecting it; scrub() walks the file.
- Compression & upkeep
- Pure-Rust LZSS per page; vacuum with retention and key rotation, atomic rename.
Time & branches
- AS OF
- SELECT … AS OF <version or timestamp> — plus history(), diff_versions() and changes().
- Branch and merge data
- Data branches with three-way diff and merge, on the Git conceptual model. Try a migration on a branch; merge when it proves out.