1. Home
  2. Ecosystem
Libraries · frameworks · providers

pgvector ecosystem

What to install in your application to talk to pgvector, which frameworks support it, and the extensions built on top. Versions checked against each package registry on 2026-10-27; the Python and Node examples were run against our test server.

Tested on pgvector 0.8.7 · PostgreSQL 18.6Updated 2026-10-275 min read

Official language bindings#

The pgvector GitHub organisation maintains client libraries for over 30 languages. They do one job: convert between your language's arrays and pgvector's types, so you never hand-format '[1,2,3]' strings — and you avoid the operator does not exist: vector <-> text error.

LanguageInstallLatest versionWorks with
Pythonpip install pgvector0.5.1 (2026-10-09)Psycopg 3 & 2, asyncpg, pg8000, SQLAlchemy, SQLModel, Django, Peewee
Node.js / TypeScriptnpm install pgvector0.3.0 (2026-05-31)node-postgres, Postgres.js, Kysely, Knex, Sequelize, TypeORM, MikroORM, Prisma, Drizzle, Bun SQL…
Gogo get github.com/pgvector/pgvector-gov0.4.1 (2026-07-30)pgx, pg, Bun, Ent, GORM, sqlx
Rustpgvector = { version = "0.4", features = ["postgres"] }0.4.2 (2026-05-22)rust-postgres, SQLx, Diesel
Rubygem "pgvector" · Rails: gem "neighbor"0.3.3 · neighbor 1.2.0pg, Sequel, Active Record (via neighbor)
Java / KotlinMaven com.pgvector:pgvector0.1.6 (2024-07-17)JDBC, Spring JDBC, Hibernate, R2DBC
C# / .NETdotnet add package Pgvector0.3.2 · EF Core 0.3.0Npgsql (C#, F#, VB), Dapper, Entity Framework Core
PHPcomposer require pgvector/pgvectorv0.2.2Laravel, Symfony, Doctrine, PgSql
Elixir{:pgvector, "~> 0.4.0"}0.4.2 (2026-10-02)Ecto, Postgrex
Dartdart pub add pgvector0.2.0postgres package

Also available: C, C++, Swift, Julia, Zig, Haskell, OCaml, Perl, R, Lua, Nim, Crystal, D and more — see the language table in the upstream README. Note that the Java binding's latest release on Maven Central is from July 2024.

Python (psycopg 3)#

pythonTested with pgvector 0.5.1 + psycopg 3.3.6
import numpy as np
import psycopg
from pgvector.psycopg import register_vector

conn = psycopg.connect("dbname=app", autocommit=True)
conn.execute("CREATE EXTENSION IF NOT EXISTS vector")
register_vector(conn)   # after CREATE EXTENSION: it looks up the vector type's OID

conn.execute("CREATE TABLE documents (id bigserial PRIMARY KEY, content text, embedding vector(3))")
conn.execute("INSERT INTO documents (content, embedding) VALUES (%s, %s)", ("hello", np.array([1, 2, 3])))

rows = conn.execute(
    "SELECT content, embedding <=> %s AS distance FROM documents ORDER BY distance LIMIT 5",
    (np.array([1, 2, 4]),),
).fetchall()
print(rows)   # [('hello', 0.00853986601633272)]

Python (SQLAlchemy 2)#

pythonTested with SQLAlchemy 2.1.6
from pgvector.sqlalchemy import Vector
from sqlalchemy import BigInteger, Text, create_engine, select
from sqlalchemy.orm import DeclarativeBase, Mapped, Session, mapped_column

class Base(DeclarativeBase):
    pass

class Document(Base):
    __tablename__ = "documents"
    id: Mapped[int] = mapped_column(BigInteger, primary_key=True)
    content: Mapped[str] = mapped_column(Text)
    embedding = mapped_column(Vector(3))

engine = create_engine("postgresql+psycopg://localhost/app")
with Session(engine) as session:
    session.add(Document(content="hello", embedding=[1, 2, 3]))
    session.commit()
    query = [1, 2, 4]
    stmt = (select(Document.content, Document.embedding.cosine_distance(query).label("distance"))
            .order_by(Document.embedding.cosine_distance(query)).limit(5))
    print(session.execute(stmt).all())   # [('hello', 0.00853986601633272)]

Comparators: l2_distance, cosine_distance, max_inner_product, l1_distance, hamming_distance, jaccard_distance. Types: VECTOR, HALFVEC, BIT, SPARSEVEC.

Node.js (node-postgres)#

jsTested with pgvector 0.3.0 + pg 8.23.1 on Node 22
import pg from 'pg';
import pgvector from 'pgvector/pg';

const client = new pg.Client();
await client.connect();
await client.query('CREATE EXTENSION IF NOT EXISTS vector');
await pgvector.registerTypes(client);

await client.query('INSERT INTO documents (content, embedding) VALUES ($1, $2)',
  ['hello', pgvector.toSql([1, 2, 3])]);

const res = await client.query(
  'SELECT content, embedding, embedding <=> $1 AS distance FROM documents ORDER BY distance LIMIT 5',
  [pgvector.toSql([1, 2, 4])]);
console.log(res.rows);
// [ { content: 'hello', embedding: [ 1, 2, 3 ], distance: 0.00853986601633272 } ]

Frameworks and ORMs#

FrameworkPackagepgvector support
LangChain (Python)langchain-postgres 0.0.19Use PGVectorStore + PGEngine (sync and async, hybrid search with RRF). The older PGVector class is deprecated since 0.0.14.
LlamaIndexllama-index-vector-stores-postgres 0.9.0PGVectorStore.from_params(…); query modes default, hybrid, sparse, text search, MMR.
Djangopgvector (Python)VectorField, HalfVectorField, BitField, SparseVectorField; CosineDistance etc.; HnswIndex, IvfflatIndex; VectorExtension() migration.
Railsneighbor 1.2.0has_neighbors :embedding, nearest_neighbors(:embedding, distance: "cosine"); halfvec, bit and sparsevec.
Drizzle ORMdrizzle-orm 0.45.4Built-in vector/halfvec/bit/sparsevec columns, cosineDistance() etc., HNSW index helper. You still run CREATE EXTENSION yourself.
Prismaprisma 7.10.1Unsupported("vector(1536)") columns plus raw SQL; prisma migrate dev doesn't manage vector indexes. Prisma 8 (release candidate) adds a dedicated pgvector package.
Spring AI, Semantic Kernel, Haystack—Each ships a pgvector vector store; check its docs for the version you use.

LangChain migration. Tutorials still import langchain_community.vectorstores.PGVector or langchain_postgres.PGVector. Both are superseded by langchain_postgres.PGVectorStore, which uses its own table layout — follow the package's migration notebook to move existing collections.

Extensions built around pgvector#

Several projects add index types pgvector doesn't have. All are separate installs; most reuse pgvector's vector type.

ExtensionFromWhat it addsStatus (2026-10-27)License
pg_vectorsearchTiger DataPRISM index (IVF-style centroid tree + RaBitQ quantization + full-precision rerank) over pgvector vector/halfvec columns. Postgres 18+.v0.1.0, alpha (announced 2026-10-13)PostgreSQL
pgvectorscaleTiger DataStreamingDiskANN index, Statistical Binary Quantization, label-filtered search.0.9.1; moving to maintenance mode in favour of pg_vectorsearchPostgreSQL
VectorChord (vchord)TensorChordvchordrq index using RaBitQ with reranking; pgvector-compatible types and syntax.1.1.1 (Feb 2026)AGPLv3 or ELv2
pgvecto.rsTensorChordRust vector extension.Superseded by VectorChord (README asks users to migrate)Apache-2.0
LanternLanternHNSW via usearch.No commits since Dec 2024 — appears inactiveAGPLv3
pg_diskannAzureDiskANN index, Azure Database for PostgreSQL only.0.6.5 on PG 14–18Managed
alloydb_scannGoogle AlloyDBScaNN index on AlloyDB.0.1.3Managed

RaBitQ, which pg_vectorsearch and VectorChord both use, quantises each dimension to one bit with a provable bound on the distance error (Gao & Long, SIGMOD 2024, arXiv:2405.12497). pgvector's own answer to the same problem is binary_quantize() plus re-ranking, which we benchmarked.

Hosted Postgres with pgvector#

Documented pgvector versions as of 2026-10-27 (most providers lag the 0.8.7 release — see what that means):

ProviderDocumented versionNotes
Amazon RDS for PostgreSQL0.8.2 (PG 14–18)0.8.0 on PG 13.
Amazon Aurora PostgreSQL0.8.2Latest minors of 14–18; previous minors have 0.8.1.
Google Cloud SQL0.8.5 (PG 13+)
Google AlloyDB0.8.5.google-1Also offers the ScaNN index.
Azure Database for PostgreSQL0.8.2 (PG 13–18)Allow-list in azure.extensions first; also offers pg_diskann.
Neon0.8.6 (PG 18), 0.8.0 (PG 14–17)Compute restart needed to pick up new versions.
SupabaseNot statedEnable in Dashboard → Extensions; installed in the extensions schema.
Tiger CloudNot statedpgvector, pgvectorscale and pg_textsearch available, not enabled by default.
DigitalOceanNot statedPre-installed on Advanced Edition (PG 16–18).
Crunchy Bridge · Heroku · RenderNot statedCREATE EXTENSION vector;

Whatever the docs say, your instance is the ground truth: SELECT default_version, installed_version FROM pg_available_extensions WHERE name = 'vector';

Operational tooling#

  • pg_stat_statements — find your slowest vector queries; it ships with Postgres.
  • pg_stat_progress_create_index — watch HNSW and IVFFlat builds (query).
  • Citus — distributes tables (and their HNSW indexes) across nodes when one machine isn't enough.
  • Our tools — the index planner and storage calculator size an index before you build it.