Check against your doze
Checking against doze
PostgreSQL
OfficialSignedReal local Postgres, declared not scripted.
doze/postgres$ doze add postgres- Newest
- 0.2.4 · 2 Nov 2026
- Needs
- any doze
- Runs
- Postgres 14 – 18
- Platforms
- macOS arm64 · Linux arm64 · Linux x86_64
- Licence
- Apache-2.0
- Source
- doze-modules
vector
pgvectorComing with postgres 0.3Store embeddings next to the rows they describe and ask for the nearest ones: a vector column type, exact search, and approximate search with HNSW and IVFFlat indexes, by L2, inner product or cosine distance.
Add it
module postgres "postgres" { version = 18 extensions = ["vector"] }
module postgres "postgres" { version = 18 extension "vector" { version = "0.8.7" } }
doze fetches the build for your Postgres major and platform once, checks its sha256, pins it in doze.lock and runs CREATE EXTENSION vector. Nothing to install, the same on a Mac and on Linux. A newer pin later runs ALTER EXTENSION vector UPDATE for you.
Postgres majors
Every extension × every major| Extension | PG 14 | PG 15 | PG 16 | PG 17 | PG 18 |
|---|---|---|---|---|---|
| vector | 0.8.7 · coming | 0.8.7 · coming | 0.8.7 · coming | 0.8.7 · coming | 0.8.7 · coming |
Coming with postgres 0.3, which needs doze 0.2.0 or newer.
Builds per platform
One bundle per extension version, Postgres major and platform, built against doze's own Postgres. Once published, each one's sha256 is pinned in doze.lock on first use. Below: Postgres 18.
| Platform | Bundle | State |
|---|---|---|
| macOS arm64 | pgext-vector-pg18-0.8.7-aarch64-apple-darwin.tar.gz | Built · not published yet |
| Linux x86_64 | pgext-vector-pg18-0.8.7-x86_64-unknown-linux-gnu.tar.gz | Not built yet |
| Linux arm64 | pgext-vector-pg18-0.8.7-aarch64-unknown-linux-gnu.tar.gz | Not built yet |
Use it from your code
CREATE EXTENSION is done for you. Make a vector column, then order by distance: <-> is L2, <=> cosine, <#> inner product.
create table items (id bigserial primary key, embedding vector(3)); create index on items using hnsw (embedding vector_l2_ops); select id from items order by embedding <-> '[3,1,2]' limit 5;
from pgvector.psycopg import register_vector import numpy as np, os, psycopg conn = psycopg.connect(os.environ["DATABASE_URL"]) register_vector(conn) conn.execute( "select id from items order by embedding <-> %s limit 5", (np.array([3, 1, 2]),))
import pg from "pg"; import pgvector from "pgvector/pg"; const client = new pg.Client(process.env.DATABASE_URL); await client.connect(); await pgvector.registerTypes(client); await client.query( "select id from items order by embedding <-> $1 limit 5", [pgvector.toSql([3, 1, 2])]);
import ( "github.com/pgvector/pgvector-go" pgxvec "github.com/pgvector/pgvector-go/pgx" ) pgxvec.RegisterTypes(ctx, conn) rows, err := conn.Query(ctx, "select id from items order by embedding <-> $1 limit 5", pgvector.NewVector([]float32{3, 1, 2}))