
pgvector
github.com/pgvector/pgvector- Category
- Developer Tools
- Rank
- No. 349Tools index
- Pricing
- Open Source
- Type
- TOOL
- Builder
- pgvector
- GitHub
- 22.7k stars
- Added
- Jul 4, 2026
About
pgvector is an open-source Postgres extension that adds vector similarity search to a database you already run — store embeddings in a column and query them with SQL for RAG.
What it does
pgvector gives Postgres native vector types, distance operators, aggregation, and nearest-neighbor indexes. Searches are exact by default. HNSW and IVFFlat provide approximate alternatives with different memory, build-time, speed, and recall characteristics. It handles dense, half-precision, binary, and sparse representations.
Why it's ranked here
The appeal is breadth inside one database system. Six distance measures, exact search, two approximate index designs, filtering with normal Postgres indexes, bulk loading, joins, transactions, and recovery all share one operational home. That makes it a strong choice when Postgres already owns the surrounding data.
What's good
The index choices have clear operating profiles. HNSW favors the speed-recall tradeoff but consumes more memory and builds more slowly. IVFFlat builds faster and uses less memory. Both expose query-time controls, while exact search remains available when recall matters more than latency.
Tradeoffs
Approximate indexes can return different results than exact search and require tuning. HNSW construction can slow significantly when its graph exceeds maintenance memory. IVFFlat needs existing data for training, plus sensible list and probe counts. Separate indexes are required for each distance measure, and indexed dense vectors are limited to 2,000 dimensions.
How to use it well
Use it when Postgres already stores the records that vectors describe and SQL filtering, joins, updates, or grouped averages matter. Start with exact queries, measure recall, then choose HNSW or IVFFlat for scale. Bring your own vectors and Postgres client application. This is an extension, not a standalone embedding generator or language-specific SDK.
Technical notes+
The Makefile builds a C PostgreSQL extension named vector through PGXS, compiles objects from src/, discovers regression cases under test/sql/*.sql, and defines Docker release targets for Linux AMD64 and ARM64. src/vector.c initializes bit, half-vector, HNSW, and IVFFlat support and validates dimensions and finite elements. src/hnsw.c and src/ivfflat.c register PostgreSQL index access methods, planner cost estimates, build phases, and user-set configuration variables. src/ivfscan.c selects nearby lists, scans their pages, sorts candidates by distance, and requires an MVCC snapshot.
Observed
- Primary language
- C, implemented against PostgreSQL extension and index access APIs
- Interface
- PostgreSQL extension exposed through SQL types, operators, aggregates, and indexes
- Database support
- Postgres 13 or newer
- Vector representations
- Single-precision, half-precision, binary, and sparse vectors
- Index types
- HNSW and IVFFlat, alongside exact nearest-neighbor search
- Installation surface
- Source builds, Docker, Homebrew, PGXN, APT, Yum, pkg, APK, conda-forge, Postgres.app, and hosted Postgres providers
- Platform support
- Linux, macOS, and Windows installation instructions
- Testing structure
- The Makefile configures SQL regression tests and Perl installation checks
Read from README.md, Makefile, src/hnsw.c, src/hnsw.h, src/bitvec.c, src/bitvec.h, src/vector.c, src/vector.h, src/halfvec.c, src/halfvec.h, src/ivfflat.c, src/ivfflat.h, src/ivfscan.c.
Tags
Tech Stack
Comments (0)
No comments yet
Indexed by a proprietary survey. Corrections welcome.