What is sqlite-vec?
sqlite-vec is a SQLite extension, written in pure C with no dependencies, that adds vector storage and similarity search to any SQLite database. You define a vec0 virtual table, insert float, int8, or binary vectors, and run nearest-neighbor (KNN) queries directly in SQL. It is a successor to the earlier sqlite-vss project. It sits in the Vector Databases category of the Retrieval & Knowledge (RAG) tools and is open-source, written in C.
Overview
sqlite-vec is a SQLite extension, written in pure C with no dependencies, that adds vector storage and similarity search to any SQLite database. You define a vec0 virtual table, insert float, int8, or binary vectors, and run nearest-neighbor (KNN) queries directly in SQL. It is a successor to the earlier sqlite-vss project.
Because it ships as a small C extension, it runs anywhere SQLite runs: Linux, macOS, Windows, Raspberry Pis, and the browser via WebAssembly. There are install packages for Python, Node.js, Ruby, Go, Rust, Datasette, rqlite, and sqlite-utils, so you can add vector search without standing up a separate database service.
It fits the embedded / in-process vector database category: the index lives inside your SQLite file alongside your regular tables, which suits local-first apps, edge deployments, and projects that already use SQLite. Note that sqlite-vec is pre-v1, so the project warns to expect breaking changes.
What it does
- Stores float, int8, and binary vectors in vec0 virtual tables
- KNN similarity search expressed in plain SQL with a MATCH clause ordered by distance
- Written in pure C with no dependencies; runs on Linux, macOS, Windows, Raspberry Pi, and in the browser via WASM
- Accepts vectors as JSON arrays or a compact binary format
- Keeps non-vector data in metadata, auxiliary, or partition key columns
- Official bindings for Python, Node.js, Ruby, Go, Rust, plus Datasette, rqlite, and sqlite-utils plugins
Getting started
Install sqlite-vec for your language, then create a vec0 virtual table and run a KNN query in SQL.
Install
Add sqlite-vec with your language's package manager. The Python package is shown here; npm, gem, cargo, and go get are also available.
pip install sqlite-vecLoad the extension and create a table
Load the vec0 extension into SQLite and create a virtual table that holds an 8-dimensional float vector column.
.load ./vec0
create virtual table vec_examples using vec0(
sample_embedding float[8]
);Insert vectors
Insert rows with vectors provided as JSON. A compact binary format is also supported.
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]');Run a KNN query
Use a MATCH clause with order by distance and a limit to find the nearest vectors to a query vector.
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;Commands and code are distilled from the project's own documentation — always check the official repo for the latest.
When to use it
- Add semantic search or retrieval to an app that already uses SQLite, without running a separate vector database
- Build local-first or offline AI features where the vector index ships inside the SQLite file
- Run vector search in the browser via WebAssembly or on resource-constrained hardware like a Raspberry Pi
- Power RAG retrieval at the edge by storing embeddings next to your application data
How sqlite-vec compares
sqlite-vec alongside other open-source vector databases tools AI/TLDR tracks, ranked by GitHub stars.
| Tool | Stars | What it does |
|---|---|---|
| Supabase | ★ 116k | Managed Postgres backend whose Vector toolkit (pgvector) stores, indexes, and queries embeddings next to transactional data. |
| Redis Cloud | ★ 77.8k | Fully-managed Redis with built-in vector search, offering low-latency similarity and hybrid queries over any embeddings. |
| Milvus | ★ 46.8k | A distributed vector database for storing and searching billions of embeddings at scale, with multiple index types and Kubernetes-native deployment. |
| FAISS | ★ 42k | A library from Meta for efficient similarity search and clustering of dense vectors, with both exact and approximate indexes. |
| Qdrant | ★ 35.8k | A Rust-based vector search engine that stores embeddings with rich payload filtering for semantic search and recommendation systems. |
| Chroma | ★ 29.8k | A developer-focused vector database designed for quickly building retrieval and RAG features with a simple Python and JavaScript API. |
| pgvector | ★ 23.9k | A PostgreSQL extension that adds a vector data type and similarity search so you can store and query embeddings inside an existing Postgres database. |
| sqlite-vec | ★ 8.3k | A small SQLite extension for vector storage and similarity search that runs anywhere SQLite runs |

