Self-host pgvector
v0.8.7Open-source vector similarity search for PostgreSQL
sudo yum install pgvector_18- Stars
- 23 644
pgvector/pgvectorWhat is pgvector?
pgvector is an extension for PostgreSQL that adds vector similarity search capabilities. It stores vectors alongside regular data and enables exact and approximate nearest neighbor searches with multiple distance functions including L2 distance, inner product, cosine distance, L1 distance, Hamming distance, and Jaccard distance. The extension provides ACID transactional guarantees, point-in-time recovery via WAL, and JOINs with other data. Installation options include compiling from source on Linux, Mac, and Windows, using Docker images, Homebrew, PGXN, APT, Yum, pkg, APK, conda-forge, or comes preinstalled with Postgres.app. The extension supports multiple vector types: vector for up to 2,000 dimensions, halfvec for up to 4,000 dimensions, bit for up to 64,000 dimensions, and sparsevec for up to 1,000 non-zero elements.
pgvector alternatives
panySelf-hosted semantic search engine running in PostgreSQL via pgvector, using CLIP embeddings for text and image search to replace Pinecone or Weaviate.Comparepany with pgvector
weaviateSelf-hosted open-source vector database that keeps objects and embeddings together, mixing semantic, BM25 and hybrid search with RAG, reranking, multi-tenancy and RBAC.Compareweaviate with pgvector
qdrantQdrant is an open-source, self-hosted vector database in Rust for fast AI similarity search with filtering and quantization.Compareqdrant with pgvector
Meme SearchMeme Search is a self-hosted, open-source meme search engine using local AI for semantic search. Run with Docker Compose to find memes by meaning, not filenames.CompareMeme Search with pgvector
helixdbA Rust-based graph database that unifies vector similarity and keyword search on object storage for AI memory workloads.Comparehelixdb with pgvector
databendSelf-hosted, open-source data warehouse in Rust for large-scale analytics plus vector and full-text search, with Python UDF sandboxes and git-like data branching.Comparedatabend with pgvector
PgStackPgStack is a self-hosted, open-source tool that creates search and audit read replicas of your Postgres database via logical replication.ComparePgStack with pgvector
memgraphSelf-hosted, open-source in-memory graph database with Cypher, vector indexes and the MAGE algorithm library for GraphRAG and real-time graph analytics.Comparememgraph with pgvector
Should you self-host pgvector?
pgvector scores 76/100 on selfhost.directory (how scoring works) and ranks #1 of 8 in Databases & storage. It has 23 644 GitHub stars, +384 in the last 30 days.
There was no stable release in the past 12 months, so check the repository's recent activity before you rely on it.
Setup is moderate: expect some configuration beyond a single command. An official Docker image is available. It is Other-licensed and written mostly in C.
Its closest alternative on selfhost.directory is tdengine (73/100, 25 191 stars). pgvector scores higher overall. See pgvector vs tdengine side by side.
Features
- ACID Compliance
- Approximate nearest neighbor search
- Binary vectors
- Exact nearest neighbor search
- Half-precision vectors
- HNSW indexing
- Hybrid Search
- IVFFlat indexing
- Multiple distance functions
- Sparse vectors
- Subvector indexing
- Vector quantization
pgvector README
Open-source vector similarity search for Postgres
Store your vectors with the rest of your data. Supports:
- exact and approximate nearest neighbor search
- single-precision, half-precision, binary, and sparse vectors
- L2 distance, inner product, cosine distance, L1 distance, Hamming distance, and Jaccard distance
- any language with a Postgres client
Plus ACID compliance, point-in-time recovery, JOINs, and all of the other great features of Postgres
FAQ
Do indexes need to fit into memory?
No, but like other index types, you'll likely see better performance if they do. You can get the size of an index with pg_size_pretty. Use half-precision indexing or binary quantization for smaller indexes.
Can I store vectors with more precision?
You can use the double precision[] or numeric[] type to store vectors with more precision.
Can I store vectors with different dimensions in the same column?
You can use vector as the type (instead of vector(n)). However, you can only create indexes on rows with the same number of dimensions using expression and partial indexing.
What if I want to index vectors with more than 2,000 dimensions?
You can use half-precision vectors or half-precision indexing to index up to 4,000 dimensions or binary quantization to index up to 64,000 dimensions. Other options are indexing subvectors or dimensionality reduction.
Is replication supported?
Yes, pgvector uses the write-ahead log (WAL), which allows for replication and point-in-time recovery.
How many vectors can be stored in a single table?
A non-partitioned table has a limit of 32 TB by default in Postgres. A partitioned table can have thousands of partitions of that size.
More in Databases & storage
RedictRedict is a distributed key/value store, an independent fork of Redis OSS 7.2.4 licensed under LGPL-3.0-only.
tdengineSelf-hosted open-source time-series database for IoT and industrial data, offering clustering, stream processing, subscriptions, TDgpt AI and Grafana or Kafka links.
TimescaleDBA time-series database for high-performance real-time analytics packaged as a Postgres extension
VitessVitess enables unlimited horizontal scaling through generalized sharding while maintaining MySQL compatibility.
Zenko CloudServerZenko CloudServer, an open-source Node.js implementation of the Amazon S3 protocol on the front-end and backend storage capabilities to multiple clouds, including Azure and Google.
ZincSearchSelf-hosted, open-source full-text search engine written in Go; a lightweight Elasticsearch alternative with an embedded web UI, ES-compatible APIs and a single binary.
Apache PinotOpen-source distributed OLAP database for user-facing apps and AI agents. Provides sub-second queries on fresh streaming data with high concurrency.
Apache SolrA self-hosted, open-source search platform offering full-text, vector, and geospatial search used by major organizations worldwide.
Docker Distribution RegistrySelf-hosted, open-source container registry implementing the OCI Distribution Specification for managing container images and artifacts.
garage-s3-webuiOpen-source admin web UI for Garage, the self-hosted S3-compatible object store: health status, cluster layout, buckets, object browser and access keys.
GlassFlow ClickHouse ETLSelf-hosted, open-source stream processor that ingests data from Kafka and OTLP into ClickHouse with deduplication, filtering, and temporal joins.
MariaDBMariaDB server is a community developed fork of MySQL server. Started by core members of the original MySQL team, MariaDB actively works with outside developers to deliver the most featureful, stable, and sanely licensed open SQL server in the industry.
0 comments