# pgvector

CreateWithAI Hub page: https://createwithaihub.com/vector-databases/pgvector
Latest version of this file: https://createwithaihub.com/vector-databases/pgvector.md

- Type: Tool · Category: Vector Databases
- Publisher: Andrew Kane (pgvector project)
- Pricing: Free · License: PostgreSQL
- Runs on: macOS, Windows, Linux, Docker / self-hosted

Open-source Postgres extension that adds a vector type plus exact and approximate nearest-neighbor search.

pgvector is an extension that adds vector similarity search to Postgres, so embeddings live in the same tables as the rest of your data and are queried with SQL. It supports exact search and approximate search with HNSW and IVFFlat indexes, several distance operators, and half-precision, binary and sparse vectors. It is preinstalled on many hosted Postgres providers and works with any Postgres client library. It suits teams who already run Postgres and want RAG or semantic search without a separate database.

Useful for: Adding semantic search over documents stored in an existing Postgres database by adding an embedding column and an HNSW index.

## Key features

- HNSW and IVFFlat approximate indexes, plus exact search
- L2, inner product, cosine, L1, Hamming and Jaccard distance operators
- vector, halfvec, bit and sparsevec types (up to 16,000 dimensions stored)
- Filtering with ordinary SQL WHERE clauses, partial indexes and iterative index scans
- Hybrid search by combining with Postgres full-text search
- Client examples for about 35 languages; packages for Docker, Homebrew, APT, Yum, PGXN and conda-forge

## Connection

- Deployment: Self-hostable, Inside Postgres
- Search: Vector, Hybrid (vector + keyword)
- Pricing model: Free to self-host

## Before you start

- Postgres 13+

## Install steps from the official documentation

Homebrew:

```
brew install pgvector
```

Docker:

```
docker pull pgvector/pgvector:pg19-trixie
```

Enable in a database:

```
CREATE EXTENSION vector;
```

## Limitations

- Indexes cover up to 2,000 dimensions for vector and 4,000 for halfvec
- No built-in BM25; keyword ranking comes from Postgres full-text search
- Requires Postgres 13+ and installing the extension (or a host that ships it)

## Official links

- Source repository: https://github.com/pgvector/pgvector
- Documentation: https://github.com/pgvector/pgvector#readme
- Source: https://github.com/pgvector/pgvector (README: index types, distance operators, vector types and limits, Postgres 13+, install methods, hybrid search, client libraries; v0.8.7)
- Source: https://raw.githubusercontent.com/pgvector/pgvector/master/LICENSE (PostgreSQL License text; repo not archived)
