asopi tech
asopi techIndie Developer

Asopitech VS

SQLite vec1 vs Alopex DB

vec1, SQLite's official vector extension: virtual tables, index modes, and approximate search with a trained model. Also explains how it differs from Alopex DB.

Updated: Oct 12, 2026

What SQLite vec1 is

vec1 is SQLite’s official vector search extension, distributed on the SQLite website. It provides approximate nearest-neighbor search through SQLite’s virtual table interface. Distances are Euclidean (L2) and cosine. It is a single portable C file, vec1.c, with no external dependencies, and it uses AVX2 on x86 and NEON on ARM. The author disclaims copyright to the source code.

How it works

  • Index method: IVFADC (inverted file with asymmetric distance computation) with OPQ (optimized product quantization).
  • Index modes: the default none mode, flat mode that packs vectors into large BLOBs for exhaustive search, or approximate search with a trained model.
  • Training and rebuild: an ANN model is created by running the aggregate function vec1_train() over a representative set of vectors. The model is passed to the virtual table with the rebuild command, which rebuilds the index.
  • Metadata columns: metadata values are embedded in the ANN index and can filter rows before distances are computed.

Main features

The virtual table is called as a table-valued function to return the nearest vectors. When metadata lives in other tables, streaming queries apply the filters. Training and rebuilding can use multiple threads.

Limits

  • The current release is 0.8, before 1.0.
  • Vector elements are 32-bit floats only.
  • IVFADC is the only index method. There is no graph-based index such as HNSW or DiskANN.
  • Distances are L2 and cosine. Dot product is not available.
  • Approximate search requires training with vec1_train() and rebuilding the index with rebuild. Approximate results may not be the true nearest neighbors.
  • All vectors must have the same number of dimensions, fixed by the first vector inserted.
  • Binaries built with SIMD instructions enabled on x86-64 do not work on machines that lack them.

How it differs from Alopex DB

Both give vector search inside SQL.

Alopex DB has a vector type and HNSW indexes in the core. An HNSW index is created with no training step, and each vector enters the index as it is inserted. Table rows and vectors are updated in the same transaction, and data lives in a single .alopex file.

We also recommend embedded Alopex DB, combining vectors with attribute conditions inside SQL. It runs right away with the quickstart.

References