pgml

pgml : Run AL/ML workloads with SQL interface

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
1890
pgml
pgml
2.10.0
RAG
MIT
Rust
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
--sLd--
No
Yes
Yes
Yes
no
no
Relationships
See Also
pg4ml
vectorize
pg_summarize
pg_tiktoken
vector
vchord
vectorscale
pg_strom

pgrx=0.12.9

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
EXT
PIGSTY
2.10.0
18
17
16
15
14
13
pgml-
RPM
PIGSTY
2.10.0
18
17
16
15
14
13
pgml_$v-
DEB
PIGSTY
2.10.0
18
17
16
15
14
13
postgresql-$v-pgml-
Linux / PGPG18PG17PG16PG15PG14PG13
el8.x86_64
MISS
PIGSTY 2.10.0
PIGSTY 2.10.0
PIGSTY 2.10.0
PIGSTY 2.10.0
PIGSTY 2.10.0
el8.aarch64
MISS
PIGSTY 2.10.0
PIGSTY 2.10.0
PIGSTY 2.10.0
PIGSTY 2.10.0
PIGSTY 2.10.0
el9.x86_64
MISS
PIGSTY 2.10.0
PIGSTY 2.9.3
PIGSTY 2.9.3
PIGSTY 2.9.3
PIGSTY 2.10.0
el9.aarch64
MISS
PIGSTY 2.10.0
PIGSTY 2.10.0
PIGSTY 2.10.0
PIGSTY 2.10.0
PIGSTY 2.10.0
el10.x86_64
MISS
MISS
MISS
MISS
MISS
MISS
el10.aarch64
MISS
MISS
MISS
MISS
MISS
MISS
d12.x86_64
MISS
PIGSTY 2.10.0
PIGSTY 2.10.0
PIGSTY 2.10.0
PIGSTY 2.10.0
PIGSTY 2.10.0
d12.aarch64
MISS
PIGSTY 2.10.0
PIGSTY 2.10.0
PIGSTY 2.10.0
PIGSTY 2.10.0
PIGSTY 2.10.0
d13.x86_64
MISS
MISS
MISS
MISS
MISS
MISS
d13.aarch64
MISS
MISS
MISS
MISS
MISS
MISS
u22.x86_64
MISS
PIGSTY 2.10.0
PIGSTY 2.10.0
PIGSTY 2.10.0
PIGSTY 2.10.0
PIGSTY 2.10.0
u22.aarch64
MISS
PIGSTY 2.10.0
PIGSTY 2.10.0
PIGSTY 2.10.0
PIGSTY 2.10.0
PIGSTY 2.10.0
u24.x86_64
MISS
PIGSTY 2.10.0
PIGSTY 2.10.0
PIGSTY 2.10.0
PIGSTY 2.10.0
PIGSTY 2.10.0
u24.aarch64
MISS
PIGSTY 2.10.0
PIGSTY 2.10.0
PIGSTY 2.10.0
PIGSTY 2.10.0
PIGSTY 2.10.0

Source

pig build pkg pgml;		# build rpm / deb with pig

Install

Make sure PGDG and PIGSTY repo available:

pig repo add pgdg pigsty -u   # add both repo and update cache

Install this extension with pig:

pig install pgml;		# install via package name, for the active PG version

pig install pgml -v 17;   # install for PG 17
pig install pgml -v 16;   # install for PG 16
pig install pgml -v 15;   # install for PG 15
pig install pgml -v 14;   # install for PG 14

Config this extension to shared_preload_libraries:

shared_preload_libraries = 'pgml';

Create this extension with:

CREATE EXTENSION pgml;

Usage

This extension is lack of maintenance

After installing the pgml extension and python dependencies on all cluster nodes, you can enable pgml on the PostgreSQL cluster.

Configure cluster with patronictl command and add pgml to shared_preload_libraries, and specify your venv dir in pgml.venv:

shared_preload_libraries: pgml, timescaledb, pg_stat_statements, auto_explain
pgml.venv: '/data/pgml'

After that, restart database cluster, and create extension with SQL command:

CREATE EXTENSION vector;        -- nice to have pgvector installed too!
CREATE EXTENSION pgml;          -- create PostgresML in current database
SELECT pgml.version();          -- print PostgresML version string

If it works, you should see something like:

# create extension pgml;
INFO:  Python version: 3.11.2 (main, Oct  5 2023, 16:06:03) [GCC 8.5.0 20210514 (Red Hat 8.5.0-18)]
INFO:  Scikit-learn 1.3.0, XGBoost 2.0.0, LightGBM 4.1.0, NumPy 1.26.1
CREATE EXTENSION

# SELECT pgml.version(); -- print PostgresML version string
 version
---------
 2.7.8

You are all set! Check PostgresML for more details: https://postgresml.org/docs/guides/use-cases/

Last updated on