SNKV

Embedded key-value store built directly on SQLite's B-tree

Image 1 of 1: SNKV deep dive page titled How a B-tree-Backed Key-Value Store Works at Every Layer

A C library that talks to SQLite's B-tree engine and skips the SQL layer: no parser, no planner, no VM. Adds WAL-mode ACID transactions, native TTL, per-value XChaCha20-Poly1305 encryption, column families and an HNSW index stored in the same .db file.

  • 588K ops/sRandom reads
  • 653K ops/sExists checks
  • 2.32×Reads vs SQLite

Trade-offs

  • Skips SQLite's SQL layer. Point reads and existence checks run about 2.3 to 2.5x faster, but tools that need the schema layer, such as the sqlite3 CLI, stop working.
  • Lazy TTL eviction with a bulk kvstore_purge_expired(), and no background thread. Nothing runs behind the caller, so expired keys stay on disk until purged.

Q&A2

RocksDB is the better choice for maximum write throughput and LMDB for maximum read speed when memory is plentiful.

Reviews

Loading reviews

    More in Vector search

    See all 13 →
    • GNOLocal knowledge engine with hybrid search, cited answers and agent memory
    • MongrelDBEmbedded Rust database with vector, sparse and text indexes
    • MenteDBRust storage engine built for AI agent memory
    • VexorSemantic search engine for files and code, for people and agents
    • ZotSeekLocal semantic search and MCP server for a Zotero library
    • AnchrSelf-hostable RAG workspace with cited answers and agentic deep reading

    More in Database internals

    See all 29 →
    • PaganelData migration engine that verifies the destination down to the row
    • FeOxDBEmbedded key-value store in Rust with write-behind durability
    • RuvioRust key-value server that speaks RESP, with locks and queues as commands
    • musqlSQLite-compatible SQL engine on columnar storage and a JIT
    • EgresPostgres-compatible database in Zig for heavy, multi-tenant workloads
    • DataZenDesktop database workspace for developers and AI agents

    More in SQLite

    See all 22 →
    • MnemosyneLocal-first agent memory in one SQLite file, with evidence on every record
    • FusionalySelf-hosted web analytics in one SQLite file
    • ForemergeCoordination protocol that catches intent conflicts between coding agents
    • roam-codeLocal code index and checks that coding agents can query
    • Crap CMSHeadless CMS in one Rust binary, with Lua hooks and a gRPC API
    • Finance GuruHousehold finance engine where typed code does the math