sqlite-vec
Tiny, dependency-free SQLite extension for vector search that runs anywhere
Repository Health
Technical Analysis
sqlite-vec is a vector search extension for SQLite, written in pure C with no external dependencies, that adds vec0 virtual tables for storing and querying float, int8, and binary vectors directly inside a SQLite database. Because it is plain C, it runs anywhere SQLite runs: Linux, macOS, Windows, Raspberry Pis, and even in the browser via WASM, making it a practical choice for local-first and edge AI applications that need semantic search without standing up a separate vector database.
The project is the successor to the earlier sqlite-vss extension and ships official bindings for multiple languages, including the Rust crate published as sqlite-vec on crates.io, which links the compiled sqlite_vec0 extension and exposes an sqlite3_vec_init entry point for loading into a rusqlite/SQLite connection. It is sponsored by Mozilla Builders as part of an effort to enable more local AI application development.
What You Get
- A loadable SQLite extension (
sqlite_vec0) providingvec0virtual tables for KNN vector search - Support for float, int8, and binary vector column types with metadata/auxiliary/partition columns alongside them
- Official bindings for Python, Rust (
sqlite-veccrate), Go, and other languages that load the same compiled extension - Pure C implementation with zero external dependencies, portable to Linux, macOS, Windows, Raspberry Pi, and WASM/browser targets
- Rescoring and approximate-search building blocks (IVF, DiskANN-inspired) for scaling beyond brute-force KNN
Common Use Cases
- Adding local semantic/embeddings search to an application that already uses SQLite, without deploying a separate vector database
- Edge and on-device AI apps (Raspberry Pi, browser via WASM, mobile) that need vector search with no network dependency
- Retrieval-augmented generation (RAG) prototypes that want a single-file database holding both relational data and embeddings
- Rust applications using
rusqlitethat need to load a vector-search extension viasqlite3_auto_extension
Under The Hood
Architecture: The core is a set of C source files (sqlite-vec.c plus sqlite-vec-ivf.c, sqlite-vec-ivf-kmeans.c, sqlite-vec-diskann.c, sqlite-vec-rescore.c) that register vec0 virtual table modules with SQLite’s extension API, documented in ARCHITECTURE.md. Per-language bindings under bindings/ (Python, Rust, Go, and others) are thin wrappers that bundle or link the compiled extension and expose a language-idiomatic loading mechanism, so all bindings share one C implementation rather than reimplementing vector search per language.
Tech Stack: Primarily C for the extension core; the Rust crate (bindings/rust) uses a build.rs to compile/link the C sources and exposes a minimal extern "C" surface (sqlite3_vec_init) for use with rusqlite’s sqlite3_auto_extension. Other bindings use each language’s native FFI/build tooling (cffi/ctypes for Python, cgo for Go).
Code Quality: The repository has an extensive tests/ directory including a dedicated tests/Cargo.toml for Rust-side tests, test.sql for SQL-level extension tests, and separate benchmarks//benchmarks-ann/ directories for performance regression tracking; the project is pre-v1 and explicitly documents that breaking changes should be expected between releases.
API Design: From SQL, the extension exposes a small number of new virtual table and function primitives (CREATE VIRTUAL TABLE ... USING vec0, vec_version(), vec_distance_* functions), keeping the SQL-facing surface close to ordinary SQLite syntax. The Rust binding’s public API is intentionally minimal — a single sqlite3_vec_init function to register with sqlite3_auto_extension — pushing most usage into standard SQL rather than a bespoke Rust API.