pgvector
Open-source vector similarity search as a native Postgres extension.
About
pgvector adds vector similarity search directly inside PostgreSQL: store embeddings in a vector column next to the rest of your relational data and query with exact or approximate nearest-neighbor search. It supports single/half-precision, binary, and sparse vectors; L2, inner product, cosine, L1, Hamming, and Jaccard distances; and inherits Postgres superpowers — ACID transactions, point-in-time recovery, and JOINs between vectors and business data. Install from source, Docker, Homebrew, APT, or use any major hosted Postgres (it ships preinstalled on many).
What it can do
- **Native SQL vectors**: `vector(n)` column type with `<->`, `<#>`, `<=>` distance operators
- **Exact + approximate search**: IVFFlat and HNSW indexes for scale
- **Many vector types**: float32, float16, binary, sparse vectors
- **Full distance coverage**: L2, inner product, cosine, L1, Hamming, Jaccard
- **Postgres everything**: ACID, JOINs, replication, point-in-time recovery
- **Every install path**: source, Docker, Homebrew, APT/Yum, PGXN, conda-forge, hosted
Setup
```bash
cd /tmp && git clone --branch v0.8.7 https://github.com/pgvector/pgvector.git
cd pgvector && make && sudo make install
```
```sql
CREATE EXTENSION vector;
CREATE TABLE docs (id bigserial PRIMARY KEY, embedding vector(1536));
SELECT * FROM docs ORDER BY embedding <-> '[0.1,0.2,...]' LIMIT 5;
```
Or skip compiling: Docker image, Homebrew (brew install pgvector), or hosted Postgres with the extension preinstalled.
Prerequisites
PostgreSQL 13+. Build tools (make, gcc) for source installs — or use a package/hosted provider.
Use cases
Works with
Trust score — 9/10
Scored 9/10 (verified tier, metrics-v1). Evidence: 23,325 GitHub stars (log-scaled vs catalog peers); blended with ~31,134,981 monthly package downloads; last push 5d ago; 0 releases/12mo; 17 open issues. Manual review: the default vectors-in-Postgres answer; 23k stars, years of maintenance, every install path; no deductions. License: PostgreSQL license (permissive, OSI-approved); GitHub API reports NOASSERTION SPDX.
★ 23,325 GitHub stars
How the trust score is built
Full methodology →- Adoption · stars/downloads, log-scaled vs peers
- 8.7/10
- Maintenance · recency, releases, issue load
- 7.9/10
- Openness · license + docs
- 10.0/10
- Manual review · sanity read + red-flag check
- 10.0/10
- · 23,325 GitHub stars (log-scaled vs catalog peers)
- · blended with ~31,134,981 monthly package downloads
- · last push 5d ago; 0 releases/12mo; 17 open issues
- · manual review: the default vectors-in-Postgres answer; 23k stars, years of maintenance, every install path; no deductions
Sources
Every fact above was checked against these sources. Where a claim comes from the provider and couldn't be independently verified, the text says so.