Vector Search Without the Cloud: memista, SQLite and HNSW

Why memista pairs SQLite metadata with an in-process USearch HNSW index, what that buys a small retrieval workload, and how to measure whether yours fits.

Every RAG tutorial tells you to pick a vector database. Pinecone, Weaviate, Qdrant, Milvus, Chroma: the landscape is crowded with products that store, index and query embeddings at scale, and almost every AI infrastructure diagram now includes one, often before anyone has asked how many vectors the application will actually hold.

We built memista because we suspected that a good share of those projects do not need one yet.

memista is a small Rust crate that pairs two well-known pieces. Chunk text and metadata go into SQLite. Vectors go into a USearch index, which uses HNSW for approximate nearest-neighbour (ANN) search. A three-endpoint Actix-web HTTP API sits in front of both. There is no cluster to manage and no cloud account: the state is a SQLite database and one index file per partition, sitting on the same disk as your application.

It is also explicitly experimental (v0.1.x), and its README describes testing only below roughly 100,000 vectors. This article explains why we built it, how it actually works, what we have and have not measured, and how to decide whether it fits your workload.

The Vector Database Hype Cycle

To be clear: dedicated vector databases solve real problems. If you have hundreds of millions of vectors, sustained high query concurrency, a need to scale horizontally across machines, or many processes writing to the index at once, a dedicated vector database is the right tool, and memista has no intention of competing there.

But many AI applications do not start with those requirements. Consider a common case: a retrieval system over a team’s internal documentation. A few thousand documents, chunked into tens of thousands of passages, queried by a handful of people, updated when someone edits a page. That is a hypothetical workload, not a benchmark, but it is a recognisable one.

For a workload like that, a separate vector service introduces:

  • A network hop: every query crosses a process boundary, and usually a network.
  • Operational surface: another service to deploy, monitor, upgrade and back up, and another set of credentials to manage.
  • Data residency questions: embeddings encode semantic information about your documents, and with a hosted service they live on someone else’s infrastructure.
  • A recurring bill: hosted pricing typically depends on stored vectors, queries or provisioned capacity. Check current pricing for your provider rather than trusting any figure in an article.

An embedded index removes most of that. The state is files on disk, backed up by copying them, and the index runs inside a process you already operate.

How memista Works

memista does not implement its own ANN algorithm. It delegates that to USearch 2.19.x, a widely used HNSW library whose distance kernels are SIMD-accelerated through simsimd, and concentrates on the parts around it: storage, identifiers, persistence and an HTTP surface.

The data model

Each logical partition is identified by a database_id and is made of two things:

  1. A SQLite table, chunks_<database_id>, holding each chunk’s id, text and metadata. The database is opened in WAL mode.
  2. A USearch index file, <database_id>.usearch, holding the vectors, keyed by the same chunk id.

The SQLite row id becomes the USearch key, which is what keeps the two halves in step.

The index configuration

The current crate configures USearch with an inner-product metric (MetricKind::IP), F32 storage (ScalarKind::F32) and USearch’s default graph-construction and search-expansion parameters. Inner product ranks by dot product; if your embedding model expects cosine similarity, normalise your vectors to unit length before inserting them and the two rankings coincide.

One honest caveat matters more than any other: the embedding dimension is hardcoded to 2 in the current crate. That is a demo default. Real use means forking the crate and setting IndexOptions::dimensions to your model’s output size, and because dimension, metric and quantisation are fixed when the index is created, changing any of them means rebuilding the index.

The request path

  • POST /v1/insert writes the chunk text and metadata to SQLite, adds the embeddings to the USearch index under the new chunk ids, and saves the index file to disk after the batch.
  • POST /v1/search runs a top-k HNSW search in USearch, then hydrates the returned keys back into text and metadata from SQLite.
  • DELETE /v1/drop drops a partition’s table and removes its index file.

The server binds to 127.0.0.1:8083 by default and serves OpenAPI documentation at /swagger, /redoc, /rapidoc and /scalar. There is no authentication, so keep it on localhost or put a reverse proxy in front of it. You can run the bundled binary, or use memista as a library and mount its create_app inside your own Actix-web server, which keeps the index inside your process.

Why SQLite for the Metadata

Splitting the work between SQLite and a specialised index is deliberate. The metadata half of a retrieval query is a relational problem that SQLite solved a long time ago; the vector half is an ANN problem that a purpose-built HNSW implementation solves better than a generic extension would.

Tooling: every language has a SQLite binding, and you can open a memista database with the sqlite3 command-line tool to see exactly what was stored.

Portability: a partition is a SQLite database plus one .usearch file. Backing it up, moving it or deleting it is a file operation.

Durability, with a caveat: SQLite in WAL mode gives you transactional writes for the metadata. The USearch save is not atomic, though, so a crash during a save can leave a corrupt index file, and a crash mid-batch can leave SQLite rows without matching vectors. Production use should wrap the save in an atomic-rename pattern and reconcile on startup. We would rather state that here than have you discover it.

Where embedcache Fits

memista stores and searches vectors; it does not create them. Upstream, embedcache does. It is a Rust library and REST service that generates embeddings locally with FastEmbed across more than twenty ONNX models (the BGE family, MiniLM, Nomic, multilingual E5) and caches the results in SQLite, keyed by a hash of the input content together with the model identifier.

The distinction worth drawing is that embedcache replaces a hosted embedding API rather than memoising one. There is no per-token bill and no rate limit, the text never leaves the machine, and an unchanged chunk on a re-ingest is a cache read rather than another inference. It runs CPU-first on the ONNX runtime, so no GPU is needed. Note that the key is the content as given: two strings that differ only in whitespace are different keys unless you normalise them before they reach the cache.

Where polymathy Fits

polymathy is the retrieval pipeline in the same family. It sits in front of a SearxNG instance, fetches the top result URLs, sends them to a content processor for chunking and embedding, and returns a map from chunk id to source URL and text. It makes no LLM call and generates no answer; what comes back is evidence with its provenance attached, and what you do with it is a separate decision.

The three projects are separable on purpose. Each speaks ordinary HTTP or exposes an ordinary crate, so any one can be replaced (a different embedder, a different index) without rewriting the others.

What We Have and Have Not Measured

An earlier version of this article quoted recall and latency figures on standard benchmark datasets. Those numbers were not backed by a published, reproducible run, and we have removed them. memista’s own site says it plainly: we don’t publish recall or latency benchmarks we haven’t earned.

What we can state is structural:

  • The ANN index is USearch’s HNSW implementation, with inner product over F32 vectors and default USearch parameters.
  • The tested scale, per the project README, is below roughly 100,000 vectors.
  • Raw vector storage is predictable arithmetic: vectors × dimensions × 4 bytes for F32, before graph overhead. For example, 100,000 vectors at 768 dimensions is about 307 MB of raw floats. That is a calculation, not a measurement of memista.

How to Measure It on Your Corpus

If you are deciding whether an embedded index is enough, measure your own workload rather than borrowing anyone’s numbers, ours included:

  1. Recall@k against an exact baseline. Take a sample of real queries, compute the true top-k by brute-force search over the full set, and report what fraction of those the HNSW index returns.
  2. Latency at your real query rate. Record p50 and p99, including the HTTP hop if you use the server, at the concurrency you expect in production rather than one query at a time.
  3. Memory footprint. Note the resident memory of the process with the index loaded, and the size of the .usearch file on disk.
  4. Insert and rebuild time. Time a full re-ingest, because that is the operation that grows with the corpus and has to fit your maintenance window.
  5. Repeat as the corpus grows. The answer that holds at your current size may not hold at ten times that size.

When to Use memista (and When Not To)

Consider memista when:

  • Your collection is within the tested range (below roughly 100,000 vectors) or you are prototyping and will measure before growing past it
  • You are comfortable forking the crate to set the embedding dimension
  • You want the state to be a SQLite file and an index file you can copy
  • You want metadata kept alongside vectors without running a second service
  • Data residency matters and the index should stay on your own machine
  • Experimental, pre-1.0 software and a GPL-3.0 licence are acceptable for your project

Use a dedicated vector database instead when:

  • You have million-scale corpora or sustained high query concurrency
  • You need horizontal scaling, replication or managed backups
  • You need concurrent writes from multiple processes
  • You need authentication, metadata filtering in the query or a choice of distance metrics
  • You need an SLA someone else is accountable for

We built memista not to compete with Pinecone or Weaviate, but to answer the question “do I need a vector database yet?” honestly. For a small corpus the answer is often no. For a growing one it eventually becomes yes, and the right time to migrate is when your measurements say so, before an incident does.