DocsDatabases
pgvector
A Postgres extension that adds a vector type, indexes and operators. Lets you reuse the database you already trust.
At a glance
License
PostgreSQL License
Hosting
Any Postgres ≥ 13
Indexes
IVFFlat, HNSW
Strength
Joins, transactions, RLS
Enable and create a table
sql
create extension if not exists vector;
create table docs (
id bigserial primary key,
content text,
embedding vector(1536)
);
create index on docs
using hnsw (embedding vector_cosine_ops)
with (m = 16, ef_construction = 64);Query
sql
select id, content
from docs
order by embedding <=> $1 -- cosine distance
limit 5;One database, fewer moving parts
For most teams under ~50M vectors, pgvector inside an existing Postgres beats running a separate vector service. You get joins, transactions, row-level security and your existing backups for free.