AI builder glossary
pgvector
An open-source Postgres extension that adds a vector column type, distance operators, and approximate nearest neighbor indexes for embeddings.
pgvector turns Postgres into a capable vector store. It adds a vector column type, operators for cosine distance, Euclidean distance, and inner product, and two approximate index types, HNSW and IVFFlat. Major managed Postgres providers support it, so for many apps enabling it is a single command.
Its biggest advantage is that vectors sit next to the rest of your data. One SQL query can filter by workspace, permissions, and recency, join to the source record, and rank by similarity. Updates happen in the same transaction as the content change, so the index doesn't drift out of sync. And Postgres's own full-text search lets you build hybrid search without another service.
Know the limits before you hit them. HNSW indexes on the standard vector type support up to 2,000 dimensions; larger embeddings can use the half-precision halfvec type, which allows HNSW up to 4,000 dimensions with usually negligible quality loss. HNSW is memory-hungry and slow to build on very large tables, and filtered queries can need tuning so the index still returns enough results.
For typical product scale, pgvector is a strong default; move to a dedicated engine when measurements say you need one.
A team adds a vector column and an HNSW index with cosine operators to its existing knowledge-base table, then writes one query that filters by workspace, excludes archived articles, and returns the ten nearest chunks.
Learn more in the course
Related terms
Go from definitions to doing
Learn to build AI-powered apps in 132 practical lessons.