frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Show HN: SNKV – SQLite's B-tree as a key-value store (C/C++ and Python bindings)

https://github.com/hash-anu/snkv
35•swaminarayan•2h ago
SQLite has six layers: SQL parser → query planner → VDBE → B-tree → pager → OS. (https://sqlite.org/arch.html) For key-value workloads you only need the bottom three.

SNKV cuts the top three layers and talks directly to SQLite's B-tree engine. No SQL strings. No query planner. No VM. Just put/get/delete on the same storage core that powers SQLite.

Python:

    pip install snkv

    from snkv import KVStore

    with KVStore("mydb.db") as db:
        db["hello"] = "world"
        print(db["hello"])   # b"world"
C/C++ (single-header, drop-in):

    #define SNKV_IMPLEMENTATION
    #include "snkv.h"

    KVStore *db;
    kvstore_open("mydb.db", &db, KVSTORE_JOURNAL_WAL);
    kvstore_put(db, "key", 3, "value", 5);
Benchmarks vs SQLite WITHOUT ROWID (1M records, identical settings):

  Sequential writes  +57%
  Random reads       +68%
  Sequential scan    +90%
  Random updates     +72%
  Random deletes    +104%
  Exists checks      +75%
  Mixed workload     +84%
  Bulk insert        +10%
Honest tradeoffs: - LMDB beats it on raw reads (memory-mapped) - RocksDB beats it on write-heavy workloads (LSM-tree) - sqlite3 CLI won't open the database (schema layer is bypassed by design)

What you get: ACID, WAL concurrency, column families, crash safety — with less overhead for read-heavy KV workloads.

Comments

Retr0id•1h ago
I'm surprised by your benchmark results.

I've considered building this exact thing before (I think I've talked about it on HN even), but the reason I didn't build it was because I was sure (on an intuitive level) the actual overhead of the SQL layer was negligible for simple k/v queries.

Where does the +104% on random deletes (for example) actually come from?

swaminarayan•1h ago
Fair skepticism — I had the same intuition going in.

The SQL layer overhead alone is probably small, you're right. The bigger gain comes from a cached read cursor. SQLite opens and closes a cursor on every operation. SNKV keeps one persistent cursor per column family sitting open on the B-tree. On random deletes that means seek + delete on an already warm cursor vs. initialize cursor + seek + delete + close on every call.

For deletes there's also prepared statement overhead in SQLite — even with prepare/bind/step/reset, that's extra work SNKV just doesn't do.

I'd genuinely like someone else to run the numbers. Benchmark source is in the repo if you want to poke at it — tests/test_benchmark.c on the SNKV side and https://github.com/hash-anu/sqllite-benchmark-kv for SQLite. If your results differ I want to know.

Retr0id•1h ago
What does "column family" mean in this context?
swaminarayan•1h ago
A named key space within the same database file — keys in "users" don't collide with keys in "sessions" but both share the same WAL and transaction.
bflesch•1h ago
Did you measure the performance impact of having multiple trees in a single file vs. having one tree per file? I'd assume one per file is faster, is that correct?
swaminarayan•53m ago
no dont know about it. I will check it out.
d1l•1h ago
Are you using ai for the comment replies too?!
derwiki•1h ago
Everyone knows the emdash is a giveaway, and they are being left in
altmanaltman•1h ago
are you reading what you're writing?
d1l•1h ago
It's a nonstop slop funnel as far as I can tell. Only ashamed I've been here for more than 5 minutes.
swaminarayan•52m ago
yes
nightfly•1h ago
It "only" doubles performance so the overheads aren't that heavy
snowhale•1h ago
the benchmark probably controls for this implicitly but wondering if they used prepared statements in the sqlite baseline. the query planner overhead is negligible for a simple put/get after the first parse, but the vtable dispatch and statement compilation on every call can add up. if the baseline is using raw sqlite3_exec strings rather than prepared + bound params, that would explain a chunk of the gap.
swaminarayan•29m ago
I have used this https://github.com/hash-anu/sqllite-benchmark-kv/blob/main/t..., in which I called sqlite3_exec for only setting PRAGMA settings, for main operations I never used it. I have used prepared/bound/step/reset functions only. so the gap isn't statement compilation overhead and the comparison is fair
m00dy•1h ago
I did the same on rust, sqlite btree behind actix. It is amazing that you don't need redis anymore.
silon42•1h ago
You never did if you're happy with local files. See dbm, gdbm, Berkeley DB...
rurban•1h ago
It doesn't beat a hashtable, but has faster sequential (=ordered) reads, and can do range iterators. The examples to not reflect that.

All random accesses are slower.

d1l•1h ago
Vibe coded trash.

that credulous hn readers will upvote this is alarming.

tlb•1h ago
What's the evidence that this is vibe-coded? Or trash?
jitl•1h ago
the readme seems like it was written to some degree by claude. if u work long enough with claude u start to pick up on its style/patterns
d1l•1h ago
If you can't tell then I'm not sure what more needs to be said. I took a look through the commit history and it was glaringly obvious to me.

To trust something like data-storage to vibe-coded nonsense is incredibly irresponsible. To promote it is even moreso. I'm just surprised you can't tell, too.

debugnik•1h ago
I don't know about trash, but this post, this repo and even their comments on this thread are blatantly written by an AI. If you still need to ask for evidence, consider that you might be AI-blind.
swaminarayan•7m ago
this is not vibe coded project, this is developed by understanding sqlite code. Have you ever looked into examples ? Have you checked the code ? Now my post got flagged. and If I use AI to understand code than what is wrong with that ? what is the use of AI ? to make person more productive, right ?
metalliqaz•3m ago
I believe it was flagged for spamming, not for "vibe code"
woadwarrior01•1h ago
Related: lite3[1] a binary JSON like serialization format using B-trees.

[1]: https://github.com/fastserial/lite3

swaminarayan•27m ago
I just looked into .c files into it, it is not using any of sqlite files. In my project I am using only sqlite layers, which are battle tested.
franticgecko3•1h ago
OP seems to self promote this project and other similar vibe coded works every few weeks under two different HN handles.

Edit: for me this post appears on the front page of HN. OP this is mission success - add this project to your résumé and stop spamming.

gjgtcbkj•1h ago
Yeah I wish substack would stop doing this too. They keep inserting their brand in HN under different handles.
swaminarayan•21m ago
this is not vibe coded project, this is developed by understanding sqlite code. Have you ever looked into examples ? Have you checked the code ? Now my post got flagged. and If I use AI to understand code than what is wrong with that ? what is the use of AI ? to make person more productive, right ?

I Pitched a Roller Coaster to Disneyland at Age 10 in 1978

https://wordglyph.xyz/one-piece-at-a-time
34•wordglyph•2h ago•10 comments

IRS Tactics Against Meta Open a New Front in the Corporate Tax Fight

https://www.nytimes.com/2026/02/24/business/irs-meta-corporate-taxes.html
27•mitchbob•2h ago•22 comments

Diode – Build, program, and simulate hardware

https://www.withdiode.com/
267•rossant•3d ago•56 comments

Goodbye InnerHTML, Hello SetHTML: Stronger XSS Protection in Firefox 148

https://hacks.mozilla.org/2026/02/goodbye-innerhtml-hello-sethtml-stronger-xss-protection-in-fire...
116•todsacerdoti•2h ago•50 comments

λProlog: Logic programming in higher-order logic

https://www.lix.polytechnique.fr/Labo/Dale.Miller/lProlog/
74•ux266478•3d ago•15 comments

Terence Tao, at 8 years old (1984) [pdf]

https://gwern.net/doc/iq/high/smpy/1984-clements.pdf
382•gurjeet•23h ago•207 comments

A distributed queue in a single JSON file on object storage

https://turbopuffer.com/blog/object-storage-queue
79•Sirupsen•3d ago•27 comments

The Missing Semester of Your CS Education – Revised for 2026

https://missing.csail.mit.edu/
160•anishathalye•23h ago•47 comments

Tiny QR code achieved using electron microscope technology

https://newatlas.com/technology/smallest-qr-code-bacteria-tu-wien/
7•jonbaer•3d ago•3 comments

Show HN: enveil – hide your .env secrets from prAIng eyes

https://github.com/GreatScott/enveil
147•parkaboy•10h ago•87 comments

I Ported Coreboot to the ThinkPad X270

https://dork.dev/posts/2026-02-20-ported-coreboot/
247•todsacerdoti•15h ago•53 comments

Show HN: X86CSS – An x86 CPU emulator written in CSS

https://lyra.horse/x86css/
194•rebane2001•12h ago•65 comments

The Age Verification Trap: Verifying age undermines everyone's data protection

https://spectrum.ieee.org/age-verification
1564•oldnetguy•1d ago•1192 comments

Blood test boosts Alzheimer's diagnosis accuracy to 94.5%, clinical study shows

https://medicalxpress.com/news/2026-02-blood-boosts-alzheimer-diagnosis-accuracy.html
349•wglb•11h ago•139 comments

Show HN: Steerling-8B, a language model that can explain any token it generates

https://www.guidelabs.ai/post/steerling-8b-base-model-release/
247•adebayoj•14h ago•72 comments

Unsung heroes: Flickr's URLs scheme

https://unsung.aresluna.org/unsung-heroes-flickrs-urls-scheme/
168•onli•3d ago•62 comments

Discord cuts ties with Peter Thiel-backed verification software

https://fortune.com/2026/02/24/discord-peter-thiel-backed-persona-identity-verification-breach/
71•robtherobber•3h ago•23 comments

Firefox 148 Launches with AI Kill Switch Feature and More Enhancements

https://serverhost.com/blog/firefox-148-launches-with-exciting-ai-kill-switch-feature-and-more-en...
371•shaunpud•9h ago•309 comments

Making Wolfram tech available as a foundation tool for LLM systems

https://writings.stephenwolfram.com/2026/02/making-wolfram-tech-available-as-a-foundation-tool-fo...
231•surprisetalk•16h ago•131 comments

Decimal-Java is a library to convert java.math.BigDecimal to and from IEEE-754r

https://github.com/FirebirdSQL/decimal-java
24•mariuz•5h ago•3 comments

“Car Wash” test with 53 models

https://opper.ai/blog/car-wash-test
309•felix089•18h ago•373 comments

ATAboy is a USB adapter for legacy CHS only style IDE (PATA) drives

https://github.com/redruM0381/ATAboy
36•zdw•3d ago•29 comments

UNIX99, a UNIX-like OS for the TI-99/4A (2025)

https://forums.atariage.com/topic/380883-unix99-a-unix-like-os-for-the-ti-994a/page/5/#findCommen...
195•marcodiego•18h ago•60 comments

Graph Topology and Battle Royale Mechanics

https://blog.lukesalamone.com/posts/beam-search-graph-pruning/
32•salamo•2d ago•1 comments

Hetzner Prices increase 30-40%

https://docs.hetzner.com/general/infrastructure-and-availability/price-adjustment/
343•williausrohr•1d ago•560 comments

A simple web we own

https://rsdoiel.github.io/blog/2026/02/21/a_simple_web_we_own.html
283•speckx•23h ago•202 comments

Show HN: PgDog – Scale Postgres without changing the app

https://github.com/pgdogdev/pgdog
294•levkk•23h ago•54 comments

Writing code is cheap now

https://simonwillison.net/guides/agentic-engineering-patterns/code-is-cheap/
274•swolpers•21h ago•344 comments

Ladybird adopts Rust, with help from AI

https://ladybird.org/posts/adopting-rust/
1218•adius•1d ago•680 comments

Intel XeSS 3: expanded support for Core Ultra/Core Ultra 2 and Arc A, B series

https://www.intel.com/content/www/us/en/download/785597/intel-arc-graphics-windows.html
53•nateb2022•11h ago•41 comments