CreateWithAIHub

Tool Andrew Kane (pgvector project)

pgvector

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

View repository ↗
Save

What it is

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.

What it's 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

How to use it

Before you start

  • Postgres 13+
Homebrew
brew install pgvector
Docker
docker pull pgvector/pgvector:pg19-trixie
Enable in a database
CREATE EXTENSION vector;

Commands are copied from the official documentation. Check the docs for the latest version before running them.

Limitations to know

  • 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)

Alternatives

Open-source vector database that stores objects and vectors, with BM25F keyword, hybrid and multimodal search.

Free plan + paidOpen source

MCP servers for this

MCP reference server that gives an AI client controlled read/write access to chosen local directories.

FreeOpen source

AWS Labs' collection of open-source MCP servers for AWS docs, the AWS API, infrastructure as code, databases, costs and more.

FreeOpen source

Open-source MCP server that gives coding agents simplified Figma layout and styling data to implement designs.

Free plan + paidOpen source

Skills for this

Hugging Face's Agent Skills for the Hub CLI, datasets, model training, evaluation, Spaces and SageMaker deployment.

FreeOpen source

Related resources

Arize's source-available, self-hosted AI observability tool for OpenTelemetry tracing, evals, datasets and prompts.

Free

Anthropic's family of proprietary large language models (Opus, Sonnet, Haiku tiers) for reasoning, coding and agents.

Paid

Stanford NLP framework for programming language-model pipelines in Python and optimizing their prompts and weights.

FreeOpen source

C/C++ engine for running LLMs and multimodal models locally on a wide range of hardware, with a built-in server.

FreeOpen source

Type to search. Use ↑ ↓ and Enter.