跳转到主要内容

pgml

Run AL/ML workloads with SQL interface

pgml : Run AL/ML workloads with SQL interface

Overview

ID Extension Package Version Category License Language
1940 pgml pgml 2.10.0 RAG MIT Rust
Attribute Has Binary Has Library Need Load Has DDL Relocatable Trusted
--sLdt- No Yes Yes Yes no yes
Relationships
Schemas pgml
See Also vectorize pg4ml pgcontext pgmnemo vector pg_summarize pg_ai_query
pgrx=0.12.9

Packages

Type Repo Version PG Major Compatibility Package Pattern Dependencies
EXT PIGSTY 2.10.0 18 17 16 15 14 pgml -
RPM PIGSTY 2.10.0 18 17 16 15 14 pgml_$v -
DEB PIGSTY 2.10.0 18 17 16 15 14 postgresql-$v-pgml -
Linux / PG PG18 PG17 PG16 PG15 PG14
el8.x86_64 N/A PIGSTY 2.10.0 PIGSTY 2.10.0 PIGSTY 2.10.0 PIGSTY 2.10.0
el8.aarch64 N/A PIGSTY 2.10.0 PIGSTY 2.10.0 PIGSTY 2.10.0 PIGSTY 2.10.0
el9.x86_64 N/A PIGSTY 2.10.0 PIGSTY 2.10.0 PIGSTY 2.10.0 PIGSTY 2.10.0
el9.aarch64 N/A PIGSTY 2.10.0 PIGSTY 2.10.0 PIGSTY 2.10.0 PIGSTY 2.10.0
el10.x86_64 N/A PIGSTY 2.10.0 PIGSTY 2.10.0 PIGSTY 2.10.0 PIGSTY 2.10.0
el10.aarch64 N/A PIGSTY 2.10.0 PIGSTY 2.10.0 PIGSTY 2.10.0 PIGSTY 2.10.0
d12.x86_64 N/A PIGSTY 2.10.0 PIGSTY 2.10.0 PIGSTY 2.10.0 PIGSTY 2.10.0
d12.aarch64 N/A PIGSTY 2.10.0 PIGSTY 2.10.0 PIGSTY 2.10.0 PIGSTY 2.10.0
d13.x86_64 N/A PIGSTY 2.10.0 PIGSTY 2.10.0 PIGSTY 2.10.0 PIGSTY 2.10.0
d13.aarch64 N/A PIGSTY 2.10.0 PIGSTY 2.10.0 PIGSTY 2.10.0 PIGSTY 2.10.0
u22.x86_64 N/A PIGSTY 2.10.0 PIGSTY 2.10.0 PIGSTY 2.10.0 PIGSTY 2.10.0
u22.aarch64 N/A PIGSTY 2.10.0 PIGSTY 2.10.0 PIGSTY 2.10.0 PIGSTY 2.10.0
u24.x86_64 N/A PIGSTY 2.10.0 PIGSTY 2.10.0 PIGSTY 2.10.0 PIGSTY 2.10.0
u24.aarch64 N/A PIGSTY 2.10.0 PIGSTY 2.10.0 PIGSTY 2.10.0 PIGSTY 2.10.0
u26.x86_64 N/A PIGSTY 2.10.0 PIGSTY 2.10.0 PIGSTY 2.10.0 PIGSTY 2.10.0
u26.aarch64 N/A PIGSTY 2.10.0 PIGSTY 2.10.0 PIGSTY 2.10.0 PIGSTY 2.10.0
Package Version OS ORG SIZE File URL
pgml_17 2.10.0 el8.x86_64 pigsty 5.7 MiB pgml_17-2.10.0-1PIGSTY.el8.x86_64.rpm
pgml_17 2.10.0 el8.aarch64 pigsty 4.8 MiB pgml_17-2.10.0-1PIGSTY.el8.aarch64.rpm
pgml_17 2.10.0 el9.x86_64 pigsty 5.3 MiB pgml_17-2.10.0-1PIGSTY.el9.x86_64.rpm
pgml_17 2.10.0 el9.aarch64 pigsty 5.1 MiB pgml_17-2.10.0-1PIGSTY.el9.aarch64.rpm
pgml_17 2.10.0 el10.x86_64 pigsty 4.9 MiB pgml_17-2.10.0-1PIGSTY.el10.x86_64.rpm
pgml_17 2.10.0 el10.aarch64 pigsty 4.6 MiB pgml_17-2.10.0-1PIGSTY.el10.aarch64.rpm
postgresql-17-pgml 2.10.0 d12.x86_64 pigsty 4.7 MiB postgresql-17-pgml_2.10.0-1PIGSTY~bookworm_amd64.deb
postgresql-17-pgml 2.10.0 d12.aarch64 pigsty 4.0 MiB postgresql-17-pgml_2.10.0-1PIGSTY~bookworm_arm64.deb
postgresql-17-pgml 2.10.0 d13.x86_64 pigsty 4.2 MiB postgresql-17-pgml_2.10.0-1PIGSTY~trixie_amd64.deb
postgresql-17-pgml 2.10.0 d13.aarch64 pigsty 3.6 MiB postgresql-17-pgml_2.10.0-1PIGSTY~trixie_arm64.deb
postgresql-17-pgml 2.10.0 u22.x86_64 pigsty 5.1 MiB postgresql-17-pgml_2.10.0-1PIGSTY~jammy_amd64.deb
postgresql-17-pgml 2.10.0 u22.aarch64 pigsty 4.8 MiB postgresql-17-pgml_2.10.0-1PIGSTY~jammy_arm64.deb
postgresql-17-pgml 2.10.0 u24.x86_64 pigsty 5.4 MiB postgresql-17-pgml_2.10.0-1PIGSTY~noble_amd64.deb
postgresql-17-pgml 2.10.0 u24.aarch64 pigsty 4.9 MiB postgresql-17-pgml_2.10.0-1PIGSTY~noble_arm64.deb
postgresql-17-pgml 2.10.0 u26.x86_64 pigsty 4.7 MiB postgresql-17-pgml_2.10.0-1PIGSTY~resolute_amd64.deb
postgresql-17-pgml 2.10.0 u26.aarch64 pigsty 4.4 MiB postgresql-17-pgml_2.10.0-1PIGSTY~resolute_arm64.deb
Package Version OS ORG SIZE File URL
pgml_16 2.10.0 el8.x86_64 pigsty 5.7 MiB pgml_16-2.10.0-1PIGSTY.el8.x86_64.rpm
pgml_16 2.10.0 el8.aarch64 pigsty 4.8 MiB pgml_16-2.10.0-1PIGSTY.el8.aarch64.rpm
pgml_16 2.10.0 el9.x86_64 pigsty 5.3 MiB pgml_16-2.10.0-1PIGSTY.el9.x86_64.rpm
pgml_16 2.10.0 el9.aarch64 pigsty 5.1 MiB pgml_16-2.10.0-1PIGSTY.el9.aarch64.rpm
pgml_16 2.10.0 el10.x86_64 pigsty 4.9 MiB pgml_16-2.10.0-1PIGSTY.el10.x86_64.rpm
pgml_16 2.10.0 el10.aarch64 pigsty 4.6 MiB pgml_16-2.10.0-1PIGSTY.el10.aarch64.rpm
postgresql-16-pgml 2.10.0 d12.x86_64 pigsty 4.7 MiB postgresql-16-pgml_2.10.0-1PIGSTY~bookworm_amd64.deb
postgresql-16-pgml 2.10.0 d12.aarch64 pigsty 4.0 MiB postgresql-16-pgml_2.10.0-1PIGSTY~bookworm_arm64.deb
postgresql-16-pgml 2.10.0 d13.x86_64 pigsty 4.2 MiB postgresql-16-pgml_2.10.0-1PIGSTY~trixie_amd64.deb
postgresql-16-pgml 2.10.0 d13.aarch64 pigsty 3.6 MiB postgresql-16-pgml_2.10.0-1PIGSTY~trixie_arm64.deb
postgresql-16-pgml 2.10.0 u22.x86_64 pigsty 5.1 MiB postgresql-16-pgml_2.10.0-1PIGSTY~jammy_amd64.deb
postgresql-16-pgml 2.10.0 u22.aarch64 pigsty 4.8 MiB postgresql-16-pgml_2.10.0-1PIGSTY~jammy_arm64.deb
postgresql-16-pgml 2.10.0 u24.x86_64 pigsty 5.4 MiB postgresql-16-pgml_2.10.0-1PIGSTY~noble_amd64.deb
postgresql-16-pgml 2.10.0 u24.aarch64 pigsty 4.9 MiB postgresql-16-pgml_2.10.0-1PIGSTY~noble_arm64.deb
postgresql-16-pgml 2.10.0 u26.x86_64 pigsty 4.7 MiB postgresql-16-pgml_2.10.0-1PIGSTY~resolute_amd64.deb
postgresql-16-pgml 2.10.0 u26.aarch64 pigsty 4.4 MiB postgresql-16-pgml_2.10.0-1PIGSTY~resolute_arm64.deb
Package Version OS ORG SIZE File URL
pgml_15 2.10.0 el8.x86_64 pigsty 5.7 MiB pgml_15-2.10.0-1PIGSTY.el8.x86_64.rpm
pgml_15 2.10.0 el8.aarch64 pigsty 4.8 MiB pgml_15-2.10.0-1PIGSTY.el8.aarch64.rpm
pgml_15 2.10.0 el9.x86_64 pigsty 5.3 MiB pgml_15-2.10.0-1PIGSTY.el9.x86_64.rpm
pgml_15 2.10.0 el9.aarch64 pigsty 5.1 MiB pgml_15-2.10.0-1PIGSTY.el9.aarch64.rpm
pgml_15 2.10.0 el10.x86_64 pigsty 4.9 MiB pgml_15-2.10.0-1PIGSTY.el10.x86_64.rpm
pgml_15 2.10.0 el10.aarch64 pigsty 4.6 MiB pgml_15-2.10.0-1PIGSTY.el10.aarch64.rpm
postgresql-15-pgml 2.10.0 d12.x86_64 pigsty 4.7 MiB postgresql-15-pgml_2.10.0-1PIGSTY~bookworm_amd64.deb
postgresql-15-pgml 2.10.0 d12.aarch64 pigsty 4.0 MiB postgresql-15-pgml_2.10.0-1PIGSTY~bookworm_arm64.deb
postgresql-15-pgml 2.10.0 d13.x86_64 pigsty 4.2 MiB postgresql-15-pgml_2.10.0-1PIGSTY~trixie_amd64.deb
postgresql-15-pgml 2.10.0 d13.aarch64 pigsty 3.6 MiB postgresql-15-pgml_2.10.0-1PIGSTY~trixie_arm64.deb
postgresql-15-pgml 2.10.0 u22.x86_64 pigsty 5.1 MiB postgresql-15-pgml_2.10.0-1PIGSTY~jammy_amd64.deb
postgresql-15-pgml 2.10.0 u22.aarch64 pigsty 4.8 MiB postgresql-15-pgml_2.10.0-1PIGSTY~jammy_arm64.deb
postgresql-15-pgml 2.10.0 u24.x86_64 pigsty 5.4 MiB postgresql-15-pgml_2.10.0-1PIGSTY~noble_amd64.deb
postgresql-15-pgml 2.10.0 u24.aarch64 pigsty 4.9 MiB postgresql-15-pgml_2.10.0-1PIGSTY~noble_arm64.deb
postgresql-15-pgml 2.10.0 u26.x86_64 pigsty 4.7 MiB postgresql-15-pgml_2.10.0-1PIGSTY~resolute_amd64.deb
postgresql-15-pgml 2.10.0 u26.aarch64 pigsty 4.4 MiB postgresql-15-pgml_2.10.0-1PIGSTY~resolute_arm64.deb
Package Version OS ORG SIZE File URL
pgml_14 2.10.0 el8.x86_64 pigsty 5.7 MiB pgml_14-2.10.0-1PIGSTY.el8.x86_64.rpm
pgml_14 2.10.0 el8.aarch64 pigsty 4.8 MiB pgml_14-2.10.0-1PIGSTY.el8.aarch64.rpm
pgml_14 2.10.0 el9.x86_64 pigsty 5.3 MiB pgml_14-2.10.0-1PIGSTY.el9.x86_64.rpm
pgml_14 2.10.0 el9.aarch64 pigsty 5.1 MiB pgml_14-2.10.0-1PIGSTY.el9.aarch64.rpm
pgml_14 2.10.0 el10.x86_64 pigsty 4.9 MiB pgml_14-2.10.0-1PIGSTY.el10.x86_64.rpm
pgml_14 2.10.0 el10.aarch64 pigsty 4.6 MiB pgml_14-2.10.0-1PIGSTY.el10.aarch64.rpm
postgresql-14-pgml 2.10.0 d12.x86_64 pigsty 4.7 MiB postgresql-14-pgml_2.10.0-1PIGSTY~bookworm_amd64.deb
postgresql-14-pgml 2.10.0 d12.aarch64 pigsty 4.0 MiB postgresql-14-pgml_2.10.0-1PIGSTY~bookworm_arm64.deb
postgresql-14-pgml 2.10.0 d13.x86_64 pigsty 4.2 MiB postgresql-14-pgml_2.10.0-1PIGSTY~trixie_amd64.deb
postgresql-14-pgml 2.10.0 d13.aarch64 pigsty 3.6 MiB postgresql-14-pgml_2.10.0-1PIGSTY~trixie_arm64.deb
postgresql-14-pgml 2.10.0 u22.x86_64 pigsty 5.1 MiB postgresql-14-pgml_2.10.0-1PIGSTY~jammy_amd64.deb
postgresql-14-pgml 2.10.0 u22.aarch64 pigsty 4.8 MiB postgresql-14-pgml_2.10.0-1PIGSTY~jammy_arm64.deb
postgresql-14-pgml 2.10.0 u24.x86_64 pigsty 5.4 MiB postgresql-14-pgml_2.10.0-1PIGSTY~noble_amd64.deb
postgresql-14-pgml 2.10.0 u24.aarch64 pigsty 4.9 MiB postgresql-14-pgml_2.10.0-1PIGSTY~noble_arm64.deb
postgresql-14-pgml 2.10.0 u26.x86_64 pigsty 4.7 MiB postgresql-14-pgml_2.10.0-1PIGSTY~resolute_amd64.deb
postgresql-14-pgml 2.10.0 u26.aarch64 pigsty 4.4 MiB postgresql-14-pgml_2.10.0-1PIGSTY~resolute_arm64.deb

Source

pig build pkg pgml;		# build rpm/deb

Install

Make sure PGDG and PIGSTY repo available:

pig repo add pgsql -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.

Edit the cluster configuration with patronictl, add pgml to shared_preload_libraries, and specify your venv directory 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/