talira

pgvector

Open-source vector similarity search for Postgres

open sourcePostgreSQLself-hostablefree

pgvector is a PostgreSQL extension for storing embeddings and searching them by similarity, next to the rest of your data. It adds vector, halfvec, bit and sparsevec types, exact and approximate nearest-neighbour search with HNSW and IVFFlat indexes, and L2, inner product, cosine, L1, Hamming and Jaccard distances, with Postgres's transactions, joins and point-in-time recovery. It supports Postgres 13 and later, comes with Postgres.app and many hosted Postgres providers, and has client libraries for dozens of languages. Andrew Kane created it, under the PostgreSQL License.

Ways to install

Problems it solves

  • store embeddings in the Postgres database we already run instead of adding a vector database
  • semantic search over our documents with SQL
  • nearest-neighbour search on millions of embeddings with an approximate index
  • filter similarity search results by tenant or other columns in the same query
  • combine keyword full-text search and vector search in Postgres for hybrid search
  • keep embeddings transactional with the rows they describe, with backups and replication
  • find similar products, images or users by their embedding
  • reduce the memory our vector index needs with half-precision or binary quantization

Features

  • vector, halfvec, bit and sparsevec types
  • exact and approximate nearest neighbour search
  • HNSW and IVFFlat indexes
  • L2, inner product, cosine, L1, Hamming and Jaccard distances
  • iterative index scans for filtered queries
  • binary quantization and half-precision indexing
  • client libraries for many languages

Limitations

  • Doesn't index full-precision vectors over 2,000 dimensions: use half-precision (up to 4,000) or binary quantization (up to 64,000)3

Alternatives

The same job

These do what pgvector does.

  1. Chroma Open-source search infrastructure for AI
  2. Pinecone The trusted AI knowledge platform
  3. Qdrant High-performance, massive-scale vector database and vector search engine for the next generation of AI
  4. Weaviate The AI database developers love
  5. LanceDB Developer-friendly OSS embedded retrieval library for multimodal AI. Search More; Manage Less.
  6. Milvus A high-performance, cloud-native vector database built for scalable vector ANN search

Compare pgvector with the top 3