What is pgvecto.rs?
pgvecto.rs is a PostgreSQL extension that adds vector similarity search to your database. It sits in the Vector Databases category of the Retrieval & Knowledge (RAG) tools and is open-source, written in Rust. To get started: run the Docker image.
Overview
pgvecto.rs is a PostgreSQL extension that adds vector similarity search to your database. It is written in Rust on top of the pgrx framework, and it gives Postgres a new vector(n) data type plus distance operators so you can store and query embeddings using ordinary SQL.
It is meant for developers who already run PostgreSQL and want to keep their embeddings next to their relational data instead of standing up a separate vector store. It supports up to 65535 dimensions, extra types such as binary vectors, FP16, and INT8, and a VBASE method that combines vector search with filters and joins.
Note that the project has been succeeded by VectorChord, which the maintainers (TensorChord) describe as having better stability and performance. New work is recommended to use VectorChord, with a migration guide provided, but pgvecto.rs remains usable as described in its README.
What it does
- Adds a vector(n) data type to PostgreSQL, supporting up to 65535 dimensions
- Three distance operators: squared Euclidean (<->), negative dot product (<#>), and cosine distance (<=>)
- VBASE method for combining vector search with relational queries (TopK + filter + join)
- Extra data types including binary vectors, FP16 (vecf16), and INT8 to reduce memory use
- Runtime SIMD dispatch that picks instructions based on the host CPU
- Stores index data separately from PostgreSQL's native storage engine
Getting started
The quickest path is the official Docker image, which ships Postgres with the extension already built. Then enable the extension and run vector queries in plain SQL.
Run the Docker image
Start a Postgres container with pgvecto.rs preinstalled. The default user is postgres and the password is the one you set here.
docker run \
--name pgvecto-rs-demo \
-e POSTGRES_PASSWORD=mysecretpassword \
-p 5432:5432 \
-d ghcr.io/tensorchord/pgvecto-rs:pg17-v0.4.0Connect and enable the extension
Connect with psql, then create the vectors extension so the vector type and operators become available.
psql -h localhost -p 5432 -U postgresCreate a table with a vector column
Enable the extension and define a table that holds embeddings as a vector column.
DROP EXTENSION IF EXISTS vectors;
CREATE EXTENSION vectors;
CREATE TABLE items (
id bigserial PRIMARY KEY,
embedding vector(3) NOT NULL -- 3 dimensions
);Insert and search vectors
Insert some embeddings, then order by a distance operator to find the nearest matches.
INSERT INTO items (embedding)
VALUES ('[1,2,3]'), ('[4,5,6]');
-- query the similar embeddings
SELECT * FROM items ORDER BY embedding <-> '[3,2,1]' LIMIT 5;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 over text or image embeddings to an app that already uses PostgreSQL
- Build a retrieval-augmented generation (RAG) or question-answering backend that keeps embeddings alongside relational data
- Run vector similarity queries with SQL filters and joins in a single Postgres query instead of a separate vector database
- Reduce embedding memory footprint with FP16 (vecf16), INT8, or binary vector types on high-dimensional data
How pgvecto.rs compares
pgvecto.rs 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. |
| pgvecto.rs | ★ 2.2k | Postgres extension for vector similarity search, written in Rust |

