Show HN: VennDB: append-only in-memory Rust DB for rows queried using bit flags ...
Show HN @show
Show HN: VennDB: append-only in-memory Rust DB for rows queried using bit flags github.com · 2 points · 0 comments · HN thread
TL;DR VennDB is a Show HN project: an append-only, in-memory Rust database for mostly static rows that are loaded at startup and then queried repeatedly with bit-flag (boolean) and enum/string filters, via a #[derive(VennDB)] macro. The authors claim it beats a hand-written roaring-bitmap index, a naive Vec scan and in-memory SQLite on their proxy-database benchmarks, with next to no dependencies. The post has 2 points and no comments yet.
- Targets read-heavy, long-lived datasets where rows are appended mostly at startup and filtered on many boolean properties and simple filter maps.
- Built with #[derive(VennDB)] on a named-field struct, generating a database type, a query builder and result types; keys give O(1) lookup by unique, non-optional id.
- Filter maps accept any type implementing Eq + Hash + Clone; they support optional values, 'any' wildcard values, multi-valued sets, and custom validators run before append.
- On 100,000 rows the authors report about 246.7 ns for three bool filters versus 1.568 µs for roaring, 4.135 ms for SQLite and 653.7 µs for naive; on 1,000,000 rows, 192 ns versus 13.79 µs, 42.23 ms and 6.984 ms.
- Index memory at peak is 6.483 MB for venn versus 7.476 MB for roaring at 100k rows, and 61.79 MB versus 59.49 MB at 1M rows, so roaring is slightly smaller at the larger size.
- Uses #![forbid(unsafe_code)], is dual-licensed MIT/Apache 2.0, has MSRV 1.96, and is tested on macOS, Windows and Ubuntu via GitHub Actions. The authors say it was built for their rama proxy framework and explicitly say it is not a replacement for a real database.
Discussion No comments have been posted yet, so the thread has no discussion to summarize.