vectorize

The simplest way to do vector search on Postgres

Overview

PackageVersionCategoryLicenseLanguage
pg_vectorize0.26.0RAGPostgreSQLRust
IDExtensionBinLibLoadCreateTrustRelocSchema
1830vectorizeNoYesNoYesNoNovectorize
Relatedpg_cron pgmq vector vchord vectorscale pg_summarize pg_tiktoken pg4ml pgml pg_later pg_similarity

Version

TypeRepoVersionPG VerPackageDeps
EXTPIGSTY0.26.01817161514pg_vectorizepg_cron, pgmq, vector
RPMPIGSTY0.26.01817161514pg_vectorize_$vpgmq_$v, pg_cron_$v, pgvector_$v
DEBPIGSTY0.26.01817161514postgresql-$v-pg-vectorizepostgresql-$v-pgmq, postgresql-$v-pg-cron, postgresql-$v-pgvector
OS / PGPG18PG17PG16PG15PG14
el8.x86_64
el8.aarch64
el9.x86_64
el9.aarch64
el10.x86_64
el10.aarch64
d12.x86_64
PIGSTY 0.26.0
PIGSTY 0.26.0
PIGSTY 0.26.0
PIGSTY 0.26.0
PIGSTY 0.26.0
d12.aarch64
PIGSTY 0.26.0
PIGSTY 0.26.0
PIGSTY 0.26.0
PIGSTY 0.26.0
PIGSTY 0.26.0
d13.x86_64
PIGSTY 0.26.0
PIGSTY 0.26.0
PIGSTY 0.26.0
PIGSTY 0.26.0
PIGSTY 0.26.0
d13.aarch64
PIGSTY 0.26.0
PIGSTY 0.26.0
PIGSTY 0.26.0
PIGSTY 0.26.0
PIGSTY 0.26.0
u22.x86_64
PIGSTY 0.26.0
PIGSTY 0.26.0
PIGSTY 0.26.0
PIGSTY 0.26.0
PIGSTY 0.26.0
u22.aarch64
PIGSTY 0.26.0
PIGSTY 0.26.0
PIGSTY 0.26.0
PIGSTY 0.26.0
PIGSTY 0.26.0
u24.x86_64
PIGSTY 0.26.0
PIGSTY 0.26.0
PIGSTY 0.26.0
PIGSTY 0.26.0
PIGSTY 0.26.0
u24.aarch64
PIGSTY 0.26.0
PIGSTY 0.26.0
PIGSTY 0.26.0
PIGSTY 0.26.0
PIGSTY 0.26.0

Build

You can build the RPM / DEB packages for pg_vectorize using pig build:

pig build pkg pg_vectorize         # build RPM / DEB packages

Install

You can install pg_vectorize directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:

pig repo add pgsql -u          # Add repo and update cache

Install the extension using pig or apt/yum/dnf:

pig install pg_vectorize;          # Install for current active PG version
pig ext install -y pg_vectorize -v 18  # PG 18
pig ext install -y pg_vectorize -v 17  # PG 17
pig ext install -y pg_vectorize -v 16  # PG 16
pig ext install -y pg_vectorize -v 15  # PG 15
pig ext install -y pg_vectorize -v 14  # PG 14
dnf install -y pg_vectorize_18       # PG 18
dnf install -y pg_vectorize_17       # PG 17
dnf install -y pg_vectorize_16       # PG 16
dnf install -y pg_vectorize_15       # PG 15
dnf install -y pg_vectorize_14       # PG 14
apt install -y postgresql-18-pg-vectorize   # PG 18
apt install -y postgresql-17-pg-vectorize   # PG 17
apt install -y postgresql-16-pg-vectorize   # PG 16
apt install -y postgresql-15-pg-vectorize   # PG 15
apt install -y postgresql-14-pg-vectorize   # PG 14

Create Extension:

CREATE EXTENSION vectorize CASCADE;  -- requires: pg_cron, pgmq, vector

Usage

pg_vectorize: The simplest way to do vector search on Postgres. Source: README.md

A Postgres extension that automates the transformation and orchestration of text to embeddings and provides hooks into the most popular LLMs. This allows you to get up and running and automate maintenance for vector search, full text search, and hybrid search, which enables you to quickly build RAG and search engines on Postgres.

This project relies heavily on pgvector for vector similarity search, pgmq for orchestration in background workers, and SentenceTransformers.

API Documentation: https://chuckhend.github.io/pg_vectorize/


Overview

pg_vectorize provides two ways to add semantic, full text, and hybrid search to any Postgres, making it easy to build retrieval-augmented generation (RAG) on Postgres.

Modes at a glance:

  • HTTP server (recommended for managed DBs): run a standalone service that connects to Postgres and exposes a REST API (POST /api/v1/table, GET /api/v1/search).
  • Postgres extension (SQL): install the extension into Postgres and use SQL functions like vectorize.table() and vectorize.search() (requires filesystem access to Postgres).

Quick Start – HTTP Server

Run Postgres and the HTTP servers locally using docker compose:

# runs Postgres, the embeddings server, and the management API
docker compose up -d

Load the example dataset into Postgres (optional):

psql postgres://postgres:postgres@localhost:5432/postgres -f server/sql/example.sql

Create an embedding job via the HTTP API. This generates embeddings for the existing data and continuously watches for updates or new data:

curl -X POST http://localhost:8080/api/v1/table -d '{
		"job_name": "my_job",
		"src_table": "my_products",
		"src_schema": "public",
		"src_columns": ["product_name", "description"],
		"primary_key": "product_id",
		"update_time_col": "updated_at",
		"model": "sentence-transformers/all-MiniLM-L6-v2"
	}' -H "Content-Type: application/json"
{"id":"16b80184-2e8e-4ee6-b7e2-1a068ff4b314"}

Search using the HTTP API:

curl -G \
  "http://localhost:8080/api/v1/search" \
  --data-urlencode "job_name=my_job" \
  --data-urlencode "query=camping backpack" \
  --data-urlencode "limit=1" \
  | jq .
[
  {
    "description": "Storage solution for carrying personal items on ones back",
    "fts_rank": 1,
    "price": 45.0,
    "product_category": "accessories",
    "product_id": 6,
    "product_name": "Backpack",
    "rrf_score": 0.03278688524590164,
    "semantic_rank": 1,
    "similarity_score": 0.6296013593673706,
    "updated_at": "2025-10-05T00:14:39.220893+00:00"
  }
]

Which Mode Should I Pick?

  • Use the HTTP server when your Postgres is managed (RDS, Cloud SQL, etc.) or you cannot install extensions. It requires only that pgvector is available in the database. You run the HTTP services separately.
  • Use the Postgres extension when you self-host Postgres and can install extensions. This provides an in-database experience and direct SQL APIs for vectorization and RAG.

Quick Start – Postgres Extension (SQL)

CREATE EXTENSION vectorize CASCADE;

Use vectorize.table() to create an embedding job and vectorize.search() to perform semantic search directly from SQL.


Last Modified 2026-03-12: add pg extension catalog (95749bf)