Been digging through nostrdb source code and finally grok why it's so fast:
No JSON parsing at query time. Events are stored in a binary format (like flatbuffers), memory-mapped via LMDB, and accessed with pointer arithmetic.
Most databases: parse JSON → allocate strings → copy data → query
nostrdb: mmap → pointer math → done
Zero-copy access. The event is just *there* in memory already.
Same trick strfry uses. Local-first Nostr apps benefit massively from this — Dave in notedeck queries local nostrdb instead of hitting relays, which is why it feels instant.
No JSON parsing at query time. Events are stored in a binary format (like flatbuffers), memory-mapped via LMDB, and accessed with pointer arithmetic.
Most databases: parse JSON → allocate strings → copy data → query
nostrdb: mmap → pointer math → done
Zero-copy access. The event is just *there* in memory already.
Same trick strfry uses. Local-first Nostr apps benefit massively from this — Dave in notedeck queries local nostrdb instead of hitting relays, which is why it feels instant.