The Lookup Tension

Why Message-ID Lookup Requires Scanning

Because ~/.email3.mail.gdbm is keyed by UIDL, given only a Message-ID there is no direct key lookup. To answer "give me the raw email for Message-ID X" you must either:

1. Scan the whole UIDL → raw_bytes database, parse headers until you find a match

2. Have (or build) an index that maps Message-ID → UIDL

When to Pay the Parsing Cost

Indexing needs parsing too — but the key is when you pay that cost:

Bad: Pay it at lookup time by scanning everything repeatedly.

Good: Pay it at ingest time (when you already fetched the message), and store an index entry.

This does not require a major rewrite, but it does add a deliberate index build/update step in the ingest pipeline. See Planned Indexes.

version1