Tools · SPBoucher
Menu

pgvector

In-depth entry

by Andrew Kane (pgvector project) · Extension

PostgreSQL extension adding vector types, distance operators and HNSW/IVFFlat indexes for similarity search inside the database

PostgreSQL licenseOpen sourceFreeSelf-hostedCloudSelf-hostable
Visit official site Compare

Link verified Nov 2, 2026

Overview

pgvector is an open-source PostgreSQL extension, written in C and maintained by Andrew Kane, that adds vector data types and similarity search to a standard PostgreSQL server. It is distributed under the PostgreSQL License and is preinstalled or installable on most managed PostgreSQL services, which has made it the usual way to add embedding search to an application that already stores its data in Postgres.

The extension defines column types for dense single-precision and half-precision vectors, binary vectors and sparse vectors, together with distance operators for Euclidean, inner-product, cosine, taxicab, Hamming and Jaccard distance. Queries use ordinary SQL: an ORDER BY on a distance expression with a LIMIT returns the nearest neighbors, and WHERE clauses filter on any other column in the same statement. Without an index results are exact; adding an HNSW or IVFFlat index trades some recall for speed on large tables, with tuning parameters exposed as index options and session settings.

Typical use is retrieval-augmented generation: embeddings produced by a model API are written next to the source text, and the application joins vector similarity with metadata filters, full-text search or access-control predicates in one query, then hands the rows to an LLM. Client support comes for free from existing PostgreSQL drivers, and helper packages exist for Python, Node, Ruby, Go and others.

The limits follow from living inside Postgres: index builds and memory use grow with table size, the indexed dimension count is capped per type, and very large or latency-critical collections may be better served by a dedicated vector engine or by partitioning. Recall under heavy filtering depends on index parameters and PostgreSQL version.

Capabilities

  • vector, halfvec, bit and sparsevec column types
  • L2, inner product, cosine, L1, Hamming and Jaccard distance operators
  • Exact search via ORDER BY plus approximate HNSW and IVFFlat indexes
  • Combine similarity with SQL filters, joins and full-text search
  • Works with any PostgreSQL driver; helper libraries for many languages
  • Available on major managed PostgreSQL services

Typical workflows

  1. Store document embeddings next to source rows for RAG
  2. Semantic search over product or listing catalogs with metadata filters
  3. Deduplicate records by embedding similarity inside existing SQL pipelines

Strengths

  • No separate vector database to operate
  • Transactions and backups shared with the rest of the data
  • Permissive license and wide hosting availability

Limitations

  • Indexed dimension limits per vector type
  • Index build time and memory grow with collection size
  • Filtering plus approximate index can reduce recall without tuning
  • Single-node scaling tied to the PostgreSQL instance

Prerequisites

  • A PostgreSQL server where the extension can be installed or enabled

Who it is for

  • Developers adding semantic search to Postgres-backed apps
  • Teams building RAG pipelines

Alternatives & comparison

Qdrant, Weaviate, Milvus and Chroma are standalone vector engines with their own storage, APIs and scaling models; pgvector instead extends an existing PostgreSQL database and uses plain SQL. Pinecone is a proprietary managed service with no self-hosted option. Elasticsearch and OpenSearch add vector fields to a full-text search engine. The usual trade-off is operational simplicity and transactional consistency with pgvector against specialized indexing features and horizontal scaling in dedicated systems.

  • Chroma

    Open-source embedding database with a minimal Python and JavaScript API, usable in-process, as a server or through Chroma Cloud

    Open sourceOpen source
  • Elasticsearch

    Distributed search and analytics engine on Apache Lucene with full-text, aggregations, vector search and ES|QL; triple-licensed AGPL, SSPL and Elastic License

    MixedOpen source
  • Milvus

    Open-source vector database from Zilliz with Lite, Standalone and Distributed deployments, many index types and GPU acceleration

    Open sourceOpen source
  • Pinecone

    Fully managed, proprietary vector database service with serverless indexes, namespaces, metadata filtering and integrated embedding and reranking

    ProprietaryFreemium
  • Qdrant

    Open-source vector search engine written in Rust with filterable HNSW indexes, sparse and multi-vector support, REST/gRPC APIs and a managed cloud

    Open sourceOpen source
  • Weaviate

    Open-source vector database in Go with pluggable vectorizer modules, hybrid BM25 and vector search, multi-tenancy and a managed cloud

    MixedOpen source
Compare pgvector with its alternatives →

Sources & verification

Primary sources consulted for this record. Claims are tied to the fields each source supports; the automated link checker re-verifies every URL on a schedule.

  • License
    pgvector LICENSE (PostgreSQL License)

    https://github.com/pgvector/pgvector/blob/master/LICENSE

    Supports: license_spdx, source_model

    checked Nov 1, 2026
  • Repository
    pgvector repository

    https://github.com/pgvector/pgvector

    Supports: name, summary, capabilities, languages

    Project README is the primary documentation

    checked Nov 1, 2026
Confidence
High
Reviewed
Nov 1, 2026
Links
Verified · Nov 2, 2026

Spotted an error?

Broken link, outdated license, wrong category, or a tool that no longer exists? Tell us; reports are reviewed by the editor.

Meilisearch

Meili SAS · Vector databases

Rust search engine for application search-as-you-type with typo tolerance, faceting and hybrid semantic search; MIT core plus BSL enterprise parts

MIT AND BUSL-1.1Open sourceFreeSelf-hostedNov 2, 2026

OpenSearch

OpenSearch Software Foundation (Linux Foundation) · Vector databases

Apache-2.0 search and analytics suite forked from Elasticsearch and Kibana, governed by the OpenSearch Software Foundation

Apache-2.0Open sourceFreeSelf-hostedBroken

Typesense

Typesense, Inc. · Vector databases

GPL-licensed in-memory search engine in C++ offering typo-tolerant instant search, faceting, vector and hybrid search, with Typesense Cloud hosting

GPL-3.0Open sourceFreeSelf-hostedNov 2, 2026