/pgvecto.rs

Vector database plugin for Postgres, written in Rust

Primary LanguageRustApache License 2.0Apache-2.0

pgvectors

Postgres vector similarity search extension.

Development

Usage

cargo pgrx run
-- install the extension
DROP EXTENSION IF EXISTS vectors;
CREATE EXTENSION vectors;
-- check the extension related functions
\df+

-- call the distance function through operators

-- square Euclidean distance
SELECT array[1, 2, 3] <-> array[3, 2, 1];
-- dot product distance
SELECT array[1, 2, 3] <#> array[3, 2, 1];
-- cosine distance
SELECT array[1, 2, 3] <=> array[3, 2, 1];