Operation-by-Operation
SQLite uses a WITHOUT ROWID table with a BLOB primary key — the fairest possible comparison. Both share identical page cache, WAL, and sync settings, the same SQLite 3.51.2 core, and are compiled with gcc -O2. All differences come from the layer above the B-tree.
70% read / 20% write / 10% delete
1M rows in one transaction
Methodology
- Dataset: 1,000,000 records written in key order, 12-byte keys (
key_%08d), 61-byte values; reads, updates, deletes and exists checks use random keys - Runs: 5 runs per engine, alternating SNKV / SQLite, each on a fresh database file; the mean ops/s of the 5 runs is reported. Deletes (5,000 ops) and mixed (20,000 ops) are short and vary most between runs
- Config: WAL journal mode,
synchronous=NORMAL, 2000-page (8 MB) page cache, 4096-byte pages — identical for both engines - SQLite schema:
CREATE TABLE kvpairs (key BLOB PRIMARY KEY, value BLOB NOT NULL) WITHOUT ROWID— single B-tree keyed on the same field, prepared statements for all DML - Build: both engines on the same SQLite 3.51.2 core,
gcc 15.2 -O2(SNKV:make BUILD=release) - WAL checkpoints: both engines auto-checkpoint (PASSIVE) once the WAL holds 1000 pages — SQLite by default, SNKV by its default
walAutoCheckpoint - Transactions: sequential writes commit every 1,000 rows; updates, deletes and the mixed workload each run in one transaction; bulk insert writes 1M rows in one transaction
- Memory: both use the same pager and page cache (2000 pages); peak RSS was not re-measured for this run
- Platform: AMD Ryzen 7 6800H, Linux 6.18 (WSL2), database files on tmpfs — results measure engine CPU cost, not disk speed
Where the Difference Comes From
SNKV and SQLite use the same B-tree storage engine at the bottom. Every performance difference comes from what each layer adds on top of it.
Run It Yourself
Both benchmarks are open source. Clone and build to reproduce results on your hardware.
C benchmark — SNKV
# From the SNKV repo root (optimised build, -O2)
make BUILD=release tests/test_benchmark
./tests/test_benchmark
C benchmark — SQLite comparison
# https://github.com/hash-anu/sqllite-benchmark-kv git clone https://github.com/hash-anu/sqllite-benchmark-kv cd sqllite-benchmark-kv make sqlite_benchmark # SQLite 3.51.2, -O2 ./sqlite_benchmark
Additional comparisons against LMDB and RocksDB:
LMDB — github.com/hash-anu/lmdb-benchmark
RocksDB — github.com/hash-anu/rocksdb-benchmark