Add Postgres-native vector retrieval to agent and RAG workflows with pgvector
Store embeddings beside application data in Postgres, create vector indexes, and query nearest neighbors for semantic search, RAG, recommendations, or agent memory retrieval.
Prerequisites
Postgres 13+, pgvector extension, SQL access to the target database, embeddings from the agent or RAG pipeline, and application code that can query Postgres
Installation
Use the upstream install or setup path that matches your environment:
- git clone --branch v0.8.2 https://github.com/pgvector/pgvector.git
- make
- make install # may need sudo
- Then re-run the installation instructions (run make clean before make if needed). If sudo is needed for make install, use:
Requirements and caveats from upstream:
- You can also install it with Docker, Homebrew, PGXN, APT, Yum, pkg, APK, or conda-forge, and it comes preinstalled with [Postgres.app](#...
- You can also install it with Docker or conda-forge.
- Or load vectors in bulk using COPY (example)
Basic usage or getting-started notes:
-
Compile and install the extension (supports Postgres 13+)
-
cd /tmp
-
cd pgvector
-
Extracted from upstream docs: https://raw.githubusercontent.com/pgvector/pgvector/HEAD/README.md