BuildNot yet confirmed elsewhere1 publisher2 min readPublished
Agent memory under a million rows: a timestamp column beats top-k
A dev.to writeup drops vector stores for a SQLite table with tag and timestamp columns. Its own numbers put the practical ceiling at a million rows, not a hundred million.
The Engineer · Build desk

What happened
- A dev.to writeup argues that below hundred-million-vector scale, a vector database for agent memory is mostly sync glue, ops overhead and unpredictable recall.
- Its replacement is a SQLite table of text, timestamp, tag and embedding blob, with recall done by a WHERE clause on tag and time.
- The author reports brute-force numpy similarity over embeddings held in SQLite running at 5 to 20 ms per query on tables under 100k items.
- The same post concedes SQL loses past a million rows or under multi-writer concurrency, absent a move to faiss or a quantised index.
- The envelope it claims to cover is agent memory under 4k tokens, or fewer than 50 documents recalled per turn.
Why it matters
- contradiction The two ceilings in the same argument are 100x apart, so the number to size a build against is a million rows, and the hundred-million headline is doing rhetorical work rather than engineering work.
- constraint The multi-writer half of the author's own fallback trigger carries no row count, so a second agent writing the same store can force the migration while the table is still small enough to scan in...
- capability Scoped recall in one query turns incident review into a lookup: you can name the agent, the tier and the time window and get exactly what it held, which is not something a top-k call promises.
- cost The overhead being avoided is on-call work, paid by whoever maintains the sync path and debugs recall that shifts under them, in return for scale most agent deployments never reach.
A hundred thousand rows of 384-dimension float32 embeddings, the size the post's own example generates [3], is 153.6 MB of vectors that a brute-force scan has to read on every query [9]. The quoted 5 to 20 milliseconds per query [14] therefore implies read bandwidth somewhere between 7.7 and 31 GB/s [10]. The slow end of that is an unremarkable single-threaded numpy pass over an in-memory buffer. The fast end is not, unless the table sits well below the stated ceiling or the scan is spread across cores. The post ships working code but no hardware, dataset or timing method behind the number [8], so treat it as an order of magnitude rather than a result: a few thousand memories are free, a hundred thousand cost real milliseconds. Even the slow end stays inside a network round trip, which is the author's basis for saying networked vector stores rarely win on individual queries [c7b].
Latency is not the strongest part of the case. The WHERE clause is. A predicate on tag and timestamp returns every row that satisfies both and nothing else, one row out of three in the worked example [2], with no approximation step and no hybrid postfilter to reason about [6]. The equivalent against a vector store is top-k with filtering bolted on before or after the ANN lookup, or a query-and-filter loop you maintain yourself [13], and what comes back depends on k and on how the index handles the predicate. According to the author, that recall also moves when embeddings drift or the embedding model is upgraded [17]. A timestamp comparison does not move. When an agent misbehaves, the gap between those two properties is the gap between reconstructing the context it had and estimating it.
What the SQL route actually charges you is a schema decision taken at insert time. The author's model of agent memory has a recent cache, a working or episodic slice, and a long-term archive rather than one flat event log [7], which in the proposed table becomes a `level` column on `memory_event` alongside `agent_id`, `tag` and `embedding` [5]. Something has to classify each memory as it is written, and the compound index on `(agent_id, level, timestamp)` [5] only earns its keep if queries name all three. Determinism has a price and that is where it is paid: the shape of recall is fixed in advance, in code you can read, instead of by tuning k until the answers look reasonable. The author is explicit that this trade only applies to layered episodic memory, and that pure semantic retrieval is what vector stores are for [4].
What to watch
- A published benchmark harness with hardware and dataset behind the 5 to 20 ms claim, which would settle whether the fast end of the range is reachable at 100k rows.
- Whether SQLite vector extensions or Postgres pgvector close the gap the post concedes at a million rows, removing the faiss migration it treats as the fallback.
- Multi-agent deployments hitting the write-concurrency limit early and reporting where the single-writer design actually breaks.
Clarity's read
What the record supports and how the coverage leans. The claims behind it follow.
Reality
- Evidence24
- Adoption
- Insufficient
- Hype gap+42
- Incentives
- Insufficient
- Confidence33
Claim ledger
Ranked by verification strength, evidence, and original report placement.
- [1]
The post claims classic SQL wins where you need precise, scoped recall, such as what facts are in recent working memory for topic X since 10 minutes ago, in a single query.
- [2]
The worked example creates a SQLite table memory(id, text, ts REAL, tag, embedding BLOB), inserts three rows, and a SELECT with WHERE tag = 'alpha' AND ts > now - 120 returns only 'Fix bug in alpha repo'.
- [3]
The post's example embedding function returns 384-dimension float32 vectors, stored as BLOBs via tobytes().
- [4]
The post says vector DBs are for pure semantic retrieval, not layered or episodic memory, and that SQL handles structured, temporal and filtered recall directly.
- [5]
The proposed schema is memory_event with id, timestamp, agent_id, level (cache/working/long_term), text, tag and embedding, plus a memory_index table for aggregated contexts, multi-agent links and session chains, and compound indexes including (agent_id, level, timestamp).
- [6]
The post describes the SQL approach as deterministic, explainable and instantly extensible, with no ANN approximation and no hybrid postfilter.
- [7]
The post argues agent memory is not a flat event log but a recent cache, an episodic or workspace slice and a long-term archive, all of which model cleanly in SQL.
- [8]
The post presents code snippets for both the SQLite and Chroma paths but no hardware, dataset or timing harness for its 5 to 20 ms figure.
- [9]
At the post's stated 100k-item ceiling and its example's 384-dimension float32 vectors, a full brute-force scan reads 153.6 MB per query.
- [10]
Scanning 153.6 MB in 20 ms implies about 7.7 GB/s of read bandwidth; doing it in 5 ms implies about 31 GB/s.
- [11]
The post concedes that at 1M+ rows or under multi-writer concurrency, SQL falls behind unless you migrate to an ops-heavy faiss or product-quantisation index setup.
- [12]
The post's two thresholds sit a factor of 100 apart: the hundred-million-vector figure above which it concedes vector DBs earn their keep, and the one-million-row figure at which it says SQL falls behind.
- [13]
The post says attempting the same scoped query with Chroma or Pinecone means wrestling with post-hoc filtering, multi-stage APIs, or hand-rolling your own query plus filter loop.
- [14]
The post reports that on tables under 100k items, brute-force numpy similarity over embeddings stored in SQLite hits 5 to 20 ms per query.
- [15]
The post states networked vector databases rarely match that per-query latency unless in batch mode or sharded.
- [16]
A dev.to post argues that unless you are at hundred-million-vector scale, vector databases add sync/async glue, ops overhead, surprising ANN recall quirks and debugging headaches, and cost you the ability to reason predictably about queries by user, timestamp or tag.
- [17]
The post states vector search gives best-effort top-k results that are often unstable when embeddings drift or models are upgraded, and that ANN recall is not a drop-in replacement for classic key+filter queries.
- [18]
The post claims that for agentic memory under 4k tokens, or fewer than 50 documents recalled per turn, classic SQL is hard to beat for speed and transparency.
Sources
1 independent publisher whose own reporting we read for this story.
- dev.toEveryone's Trying Vectors and Graphs for AI Memory. We Went Back to SQL.
1 article · August 23, 2026
Topics and entities
Follow any of these and your For You feed starts watching them — no settings page required.