MerchantryTidbits

rag-retrieval / library

pgvector

Capability: pgvector

Use it when

  • Your application data already lives in Postgres and you need nearest neighbor search over embeddings without operating a separate vector database
  • You need vector search with ACID transactions, JOINs against relational tables, replication, and point-in-time recovery rather than a standalone index

What it solves

Not the fit when

  • stacks with no Postgres server available
  • producing embeddings from text or images
  • indexing full-precision vectors above 2000 dimensions without half-precision or binary quantization workarounds
  • embedding generation
  • document chunking and ingestion pipelines
  • managed hosted vector service
  • retrieval orchestration or reranking logic

Install

cd /tmp && git clone --branch v0.8.6 https://github.com/pgvector/pgvector.git && cd pgvector && make && make install (Postgres 13+; also available via Docker image pgvector/pgvector:pg18-trixie, brew install pgvector, apt, yum, and other package managers)

Invoke

CREATE EXTENSION vector; then CREATE TABLE items (id bigserial PRIMARY KEY, embedding vector(3)); and query nearest neighbors with SELECT * FROM items ORDER BY embedding <-> '[3,1,2]' LIMIT 5; add an HNSW index with CREATE INDEX ON items USING hnsw (embedding vector_l2_ops);

Alternatives

No reviewed alternatives recorded yet.