Skip to content

Vector search

Tested with: PostgreSQL 17 · pgvector 0.8 · automatic embeddings not yet available

pgvector stores embeddings next to your rows and finds the nearest ones with an index. Turn on the vector extension in the extensions manager and use it from SQL today.

SQL
create table documents (id bigint generated always as identity primary key, body text, embedding vector(1536));
create index on documents using hnsw (embedding vector_cosine_ops);
-- The 5 documents closest to a query embedding
select id, body from documents order by embedding <=> $1 limit 5;

Expose a search function through the Data API with rpc to call it from your app.

A vector panel in the portal adds an embedding column to a table, keeps it in sync when rows change through a trigger, a queue and a worker, builds the index and lets you try a search, without writing the pipeline yourself.