A vector search SQLite extension that runs anywhere!
Find a file
Alex Garcia cdbc34785f Fix fuzzer-found bugs and CI build issues
- fuzz.yaml: embed rpath to Homebrew LLVM's libc++ so macOS binaries can
  find the right C++ runtime at load time (fixes dyld weak-def crash)
- fuzz.yaml: add `make sqlite-vec.h` step on all platforms before building
  fuzz targets (the header is generated from a template, not checked in)
- fuzz.yaml: drop llvm version pin on Windows so choco succeeds when a
  newer LLVM is already installed on the runner
- sqlite-vec.c: change fvec_cleanup / fvec_cleanup_noop to take void*
  instead of f32* so they are ABI-compatible with vector_cleanup; removes
  UBSAN indirect-call errors at many call sites
- sqlite-vec.c: copy BLOB data into sqlite3_malloc'd buffer in
  fvec_from_value instead of aliasing the raw blob pointer, fixing UBSAN
  misaligned-load errors when SQLite hands us an unaligned blob
- sqlite-vec.c: guard npy_token_next string scan with ptr < end check
  before the closing-quote dereference (heap-buffer-overflow)
- sqlite-vec.c: clamp vec_quantize_int8 intermediate value to [-128, 127]
  before casting to i8 (UBSAN out-of-range conversion)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-03 07:16:33 -08:00
.github Fix fuzzer-found bugs and CI build issues 2026-03-03 07:16:33 -08:00
benchmarks benchmark updates 2024-07-28 11:08:12 -07:00
bindings fix ncruces build 2024-10-11 09:14:24 -07:00
examples node:sqlite sample 2025-01-24 13:30:14 -08:00
scripts always include notes, even on alpha releases 2024-08-05 16:04:08 -07:00
site doc improve 2025-01-31 16:46:42 -08:00
tests Add UBSAN findings TODO and improve vec-mismatch fuzzer 2026-03-02 21:19:33 -08:00
.gitignore Metadata filtering (#124) 2024-11-20 00:59:34 -08:00
ARCHITECTURE.md Metadata filtering (#124) 2024-11-20 00:59:34 -08:00
LICENSE-APACHE add licenses 2024-05-10 22:42:10 -07:00
LICENSE-MIT add licenses 2024-05-10 22:42:10 -07:00
Makefile Add comprehensive fuzz testing infrastructure with 6 new targets 2026-03-02 20:33:05 -08:00
README.md sponsor update 2025-01-24 12:00:41 -08:00
reference.yaml Remove vec_npy_each from default entrypoint and move to sqlite3_vec_numpy_init entrypoint 2024-09-25 23:07:17 -07:00
SECURITY.md add security doc 2024-09-26 00:22:31 -07:00
sqlite-dist.toml update sqlite-dist 2024-08-05 16:03:09 -07:00
sqlite-vec.c Fix fuzzer-found bugs and CI build issues 2026-03-03 07:16:33 -08:00
sqlite-vec.h.tmpl cleanup 2024-11-20 06:48:13 -08:00
test.sql Metadata filtering (#124) 2024-11-20 00:59:34 -08:00
tmp-static.py static updates 2024-07-31 12:56:09 -07:00
TODO Metadata filtering (#124) 2024-11-20 00:59:34 -08:00
VERSION v0.1.7-alpha.10 2026-02-13 09:54:41 -08:00

sqlite-vec

An extremely small, "fast enough" vector search SQLite extension that runs anywhere! A successor to sqlite-vss

Important

sqlite-vec is a pre-v1, so expect breaking changes!

  • Store and query float, int8, and binary vectors in vec0 virtual tables
  • Written in pure C, no dependencies, runs anywhere SQLite runs (Linux/MacOS/Windows, in the browser with WASM, Raspberry Pis, etc.)
  • Store non-vector data in metadata, auxiliary, or partition key columns

Mozilla Builders logo

sqlite-vec is a Mozilla Builders project, with additional sponsorship from Fly.io , Turso, SQLite Cloud, and Shinkai. See the Sponsors section for more details.

Installing

See Installing sqlite-vec for more details.

Language Install More Info
Python pip install sqlite-vec sqlite-vec with Python PyPI
Node.js npm install sqlite-vec sqlite-vec with Node.js npm
Ruby gem install sqlite-vec sqlite-vec with Ruby Gem
Go go get -u github.com/asg017/sqlite-vec/bindings/go sqlite-vec with Go Go Reference
Rust cargo add sqlite-vec sqlite-vec with Rust Crates.io
Datasette datasette install datasette-sqlite-vec sqlite-vec with Datasette Datasette
rqlite rqlited -extensions-path=sqlite-vec.tar.gz sqlite-vec with rqlite rqlite
sqlite-utils sqlite-utils install sqlite-utils-sqlite-vec sqlite-vec with sqlite-utils sqlite-utils
Github Release GitHub tag (latest SemVer pre-release)

Sample usage

.load ./vec0

create virtual table vec_examples using vec0(
  sample_embedding float[8]
);

-- vectors can be provided as JSON or in a compact binary format
insert into vec_examples(rowid, sample_embedding)
  values
    (1, '[-0.200, 0.250, 0.341, -0.211, 0.645, 0.935, -0.316, -0.924]'),
    (2, '[0.443, -0.501, 0.355, -0.771, 0.707, -0.708, -0.185, 0.362]'),
    (3, '[0.716, -0.927, 0.134, 0.052, -0.669, 0.793, -0.634, -0.162]'),
    (4, '[-0.710, 0.330, 0.656, 0.041, -0.990, 0.726, 0.385, -0.958]');


-- KNN style query
select
  rowid,
  distance
from vec_examples
where sample_embedding match '[0.890, 0.544, 0.825, 0.961, 0.358, 0.0196, 0.521, 0.175]'
order by distance
limit 2;
/*
┌───────┬──────────────────┐
│ rowid │     distance     │
├───────┼──────────────────┤
│ 2     │ 2.38687372207642 │
│ 1     │ 2.38978505134583 │
└───────┴──────────────────┘
*/

Sponsors

Development of sqlite-vec is supported by multiple generous sponsors! Mozilla is the main sponsor through the new Builders project.

Mozilla Builders logo

sqlite-vec is also sponsored by the following companies:

Fly.io logo Turso logo SQLite Cloud logo Shinkai logo

As well as multiple individual supporters on Github sponsors!

If your company interested in sponsoring sqlite-vec development, send me an email to get more info: https://alexgarcia.xyz

See Also

  • sqlite-ecosystem, Maybe more 3rd party SQLite extensions I've developed
  • sqlite-rembed, Generate text embeddings from remote APIs like OpenAI/Nomic/Ollama, meant for testing and SQL scripts
  • sqlite-lembed, Generate text embeddings locally from embedding models in the .gguf format