pgvecto.rs

tensorchord/pgvecto.rs

Scalable, Low-latency and Hybrid-enabled Vector Search in Postgres

2.2k
Stars
84
Forks
76
Open issues
20
Watchers
Rust Apache-2.0Last pushed Feb 26, 2025

Overview

pgvecto.rs is a Rust-based PostgreSQL extension that provides scalable vector search capabilities with support for high-dimensional data, advanced filtering techniques, and multiple data types.

Categories

Tags

Similar tools

Install

cargo add pgvecto.rs

README

pgvecto.rs

discord invitation link trackgit-views all-contributors

pgvecto.rs is a Postgres extension that provides vector similarity search functions. It is written in Rust and based on pgrx.

[!NOTE] We have a new implementation VectorChord with better stability and performance. Users are encouraged to migrate to VectorChord. Check out the migration guide.

Comparison with pgvector

Checkout pgvecto.rs vs pgvector for more details.

Featurepgvecto.rspgvector
FilteringIntroduces VBASE method for vector search and relational query (e.g. Single-Vector TopK + Filter + Join).When filters are applied, the results may be incomplete. For example, if you originally intended to limit the results to 10, you might end up with only 5 results with filters.
Vector DimensionsSupports up to 65535 dimensions.Supports up to 2000 dimensions.
SIMDSIMD instructions are dynamically dispatched at runtime to maximize performance based on the capabilities of the specific machine.Added CPU dispatching for distance functions on Linux x86-64" in 0.7.0.
Data TypesIntroduces additional data types: binary vectors, FP16 (16-bit floating point), and INT8 (8-bit integer).-
IndexingHandles the storage and memory of indexes separately from PostgreSQLRelies on the native storage engine of PostgreSQL
WAL SupportProvides Write-Ahead Logging (WAL) support for data, index support is working in progress.Provides Write-Ahead Logging (WAL) support for index and data.

Documentation

Quick start

For new users, we recommend using the Docker image to get started quickly.

docker run \
  --name pgvecto-rs-demo \
  -e POSTGRES_PASSWORD=mysecretpassword \
  -p 5432:5432 \
  -d ghcr.io/tensorchord/pgvecto-rs:pg17-v0.4.0

Then you can connect to the database using the psql command line tool. The default username is postgres, and the default password is mysecretpassword.

psql -h localhost -p 5432 -U postgres

Run the following SQL to ensure the extension is enabled.

DROP EXTENSION IF EXISTS vectors;
CREATE EXTENSION vectors;

pgvecto.rs introduces a new data type vector(n) denoting an n-dimensional vector. The n within the brackets signifies the dimensions of the vector.

You could create a table with the following SQL.

-- create table