Skip to content

pg_embedder

In-backend text embedding inference using Rust, Candle, and packaged models.

pg_embedder · In-backend text embedding inference using Rust, Candle, and packaged models.

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
101905pg_embedderpg_embedder0.2.0RAGMITRust

PostgreSQL · 13, 14, 15, 16, 17, 18

Usage

Sources:

pg_embedder In-backend text embedding inference using Rust, Candle, and packaged models.

Enablement

Install the files for the intended server, then create pg_embedder in the target database:

CREATE EXTENSION pg_embedder;

Core Workflow

The following example is taken from the reviewed upstream documentation. Adapt object names, paths, credentials, and workload values before use.

-- index side
UPDATE docs SET embedding = embed_encode(content);

-- search side, correct for every model
SELECT id, content, cosine_similarity(embedding, embed_query('how does vector search work')) AS score
FROM docs
ORDER BY score DESC
LIMIT 5;

Main Objects

The reviewed install surface includes these prominent objects:

ObjectKindOperational role
embed_encodeFUNCTIONCallable function from the reviewed install surface.
embed_textFUNCTIONCallable function from the reviewed install surface.
docsTABLEExtension-owned table; account for its data in backup and upgrades.
cosine_similarityFUNCTIONCallable function from the reviewed install surface.
embed_initFUNCTIONCallable function from the reviewed install surface.
embed_modelFUNCTIONCallable function from the reviewed install surface.
embed_queryFUNCTIONCallable function from the reviewed install surface.
embed_infoFUNCTIONCallable function from the reviewed install surface.

Operations and Boundaries

  • The verified PostgreSQL-major evidence covers 13, 14, 15, 16, 17, 18; do not infer unlisted majors.

Table reader