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 AvailabilityPackage PatternDependencies
EL
PIGSTY
2.10.0
18
17
16
15
14
13
pgml_$v-
Debian
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
PackageVersionOSORGSIZEFile URL
pgml_172.10.0el8.x86_64pigsty5.7 MiBpgml_17-2.10.0-1PIGSTY.el8.x86_64.rpm
pgml_172.10.0el8.aarch64pigsty4.8 MiBpgml_17-2.10.0-1PIGSTY.el8.aarch64.rpm
pgml_172.10.0el9.x86_64pigsty5.3 MiBpgml_17-2.10.0-1PIGSTY.el9.x86_64.rpm
pgml_172.10.0el9.aarch64pigsty5.1 MiBpgml_17-2.10.0-1PIGSTY.el9.aarch64.rpm
postgresql-17-pgml2.10.0d12.x86_64pigsty4.7 MiBpostgresql-17-pgml_2.10.0-1PIGSTY~bookworm_amd64.deb
postgresql-17-pgml2.10.0d12.aarch64pigsty4.0 MiBpostgresql-17-pgml_2.10.0-1PIGSTY~bookworm_arm64.deb
postgresql-17-pgml2.10.0u22.x86_64pigsty5.1 MiBpostgresql-17-pgml_2.10.0-1PIGSTY~jammy_amd64.deb
postgresql-17-pgml2.10.0u22.aarch64pigsty4.8 MiBpostgresql-17-pgml_2.10.0-1PIGSTY~jammy_arm64.deb
postgresql-17-pgml2.10.0u24.x86_64pigsty5.4 MiBpostgresql-17-pgml_2.10.0-1PIGSTY~noble_amd64.deb
postgresql-17-pgml2.10.0u24.aarch64pigsty4.9 MiBpostgresql-17-pgml_2.10.0-1PIGSTY~noble_arm64.deb
PackageVersionOSORGSIZEFile URL
pgml_162.10.0el8.x86_64pigsty5.7 MiBpgml_16-2.10.0-1PIGSTY.el8.x86_64.rpm
pgml_162.10.0el8.aarch64pigsty4.8 MiBpgml_16-2.10.0-1PIGSTY.el8.aarch64.rpm
pgml_162.9.3el9.x86_64pigsty4.6 MiBpgml_16-2.9.3-1PIGSTY.el9.x86_64.rpm
pgml_162.10.0el9.x86_64pigsty5.3 MiBpgml_16-2.10.0-1PIGSTY.el9.x86_64.rpm
pgml_162.10.0el9.aarch64pigsty5.1 MiBpgml_16-2.10.0-1PIGSTY.el9.aarch64.rpm
postgresql-16-pgml2.10.0d12.x86_64pigsty4.7 MiBpostgresql-16-pgml_2.10.0-1PIGSTY~bookworm_amd64.deb
postgresql-16-pgml2.10.0d12.aarch64pigsty4.0 MiBpostgresql-16-pgml_2.10.0-1PIGSTY~bookworm_arm64.deb
postgresql-16-pgml2.10.0u22.x86_64pigsty5.1 MiBpostgresql-16-pgml_2.10.0-1PIGSTY~jammy_amd64.deb
postgresql-16-pgml2.10.0u22.aarch64pigsty4.8 MiBpostgresql-16-pgml_2.10.0-1PIGSTY~jammy_arm64.deb
postgresql-16-pgml2.10.0u24.x86_64pigsty5.4 MiBpostgresql-16-pgml_2.10.0-1PIGSTY~noble_amd64.deb
postgresql-16-pgml2.10.0u24.aarch64pigsty4.9 MiBpostgresql-16-pgml_2.10.0-1PIGSTY~noble_arm64.deb
PackageVersionOSORGSIZEFile URL
pgml_152.10.0el8.x86_64pigsty5.7 MiBpgml_15-2.10.0-1PIGSTY.el8.x86_64.rpm
pgml_152.10.0el8.aarch64pigsty4.8 MiBpgml_15-2.10.0-1PIGSTY.el8.aarch64.rpm
pgml_152.9.3el9.x86_64pigsty4.6 MiBpgml_15-2.9.3-1PIGSTY.el9.x86_64.rpm
pgml_152.10.0el9.x86_64pigsty5.3 MiBpgml_15-2.10.0-1PIGSTY.el9.x86_64.rpm
pgml_152.10.0el9.aarch64pigsty5.1 MiBpgml_15-2.10.0-1PIGSTY.el9.aarch64.rpm
postgresql-15-pgml2.10.0d12.x86_64pigsty4.7 MiBpostgresql-15-pgml_2.10.0-1PIGSTY~bookworm_amd64.deb
postgresql-15-pgml2.10.0d12.aarch64pigsty4.0 MiBpostgresql-15-pgml_2.10.0-1PIGSTY~bookworm_arm64.deb
postgresql-15-pgml2.10.0u22.x86_64pigsty5.1 MiBpostgresql-15-pgml_2.10.0-1PIGSTY~jammy_amd64.deb
postgresql-15-pgml2.10.0u22.aarch64pigsty4.8 MiBpostgresql-15-pgml_2.10.0-1PIGSTY~jammy_arm64.deb
postgresql-15-pgml2.10.0u24.x86_64pigsty5.4 MiBpostgresql-15-pgml_2.10.0-1PIGSTY~noble_amd64.deb
postgresql-15-pgml2.10.0u24.aarch64pigsty4.9 MiBpostgresql-15-pgml_2.10.0-1PIGSTY~noble_arm64.deb
PackageVersionOSORGSIZEFile URL
pgml_142.10.0el8.x86_64pigsty5.7 MiBpgml_14-2.10.0-1PIGSTY.el8.x86_64.rpm
pgml_142.10.0el8.aarch64pigsty4.8 MiBpgml_14-2.10.0-1PIGSTY.el8.aarch64.rpm
pgml_142.9.3el9.x86_64pigsty4.6 MiBpgml_14-2.9.3-1PIGSTY.el9.x86_64.rpm
pgml_142.10.0el9.x86_64pigsty5.3 MiBpgml_14-2.10.0-1PIGSTY.el9.x86_64.rpm
pgml_142.10.0el9.aarch64pigsty5.1 MiBpgml_14-2.10.0-1PIGSTY.el9.aarch64.rpm
postgresql-14-pgml2.10.0d12.x86_64pigsty4.7 MiBpostgresql-14-pgml_2.10.0-1PIGSTY~bookworm_amd64.deb
postgresql-14-pgml2.10.0d12.aarch64pigsty4.0 MiBpostgresql-14-pgml_2.10.0-1PIGSTY~bookworm_arm64.deb
postgresql-14-pgml2.10.0u22.x86_64pigsty5.1 MiBpostgresql-14-pgml_2.10.0-1PIGSTY~jammy_amd64.deb
postgresql-14-pgml2.10.0u22.aarch64pigsty4.8 MiBpostgresql-14-pgml_2.10.0-1PIGSTY~jammy_arm64.deb
postgresql-14-pgml2.10.0u24.x86_64pigsty5.4 MiBpostgresql-14-pgml_2.10.0-1PIGSTY~noble_amd64.deb
postgresql-14-pgml2.10.0u24.aarch64pigsty4.9 MiBpostgresql-14-pgml_2.10.0-1PIGSTY~noble_arm64.deb
PackageVersionOSORGSIZEFile URL
pgml_132.10.0el8.x86_64pigsty5.7 MiBpgml_13-2.10.0-1PIGSTY.el8.x86_64.rpm
pgml_132.10.0el8.aarch64pigsty4.8 MiBpgml_13-2.10.0-1PIGSTY.el8.aarch64.rpm
pgml_132.10.0el9.x86_64pigsty5.3 MiBpgml_13-2.10.0-1PIGSTY.el9.x86_64.rpm
pgml_132.10.0el9.aarch64pigsty5.1 MiBpgml_13-2.10.0-1PIGSTY.el9.aarch64.rpm
postgresql-13-pgml2.10.0d12.x86_64pigsty4.7 MiBpostgresql-13-pgml_2.10.0-1PIGSTY~bookworm_amd64.deb
postgresql-13-pgml2.10.0d12.aarch64pigsty4.0 MiBpostgresql-13-pgml_2.10.0-1PIGSTY~bookworm_arm64.deb
postgresql-13-pgml2.10.0u22.x86_64pigsty5.1 MiBpostgresql-13-pgml_2.10.0-1PIGSTY~jammy_amd64.deb
postgresql-13-pgml2.10.0u22.aarch64pigsty4.8 MiBpostgresql-13-pgml_2.10.0-1PIGSTY~jammy_arm64.deb
postgresql-13-pgml2.10.0u24.x86_64pigsty5.4 MiBpostgresql-13-pgml_2.10.0-1PIGSTY~noble_amd64.deb
postgresql-13-pgml2.10.0u24.aarch64pigsty4.9 MiBpostgresql-13-pgml_2.10.0-1PIGSTY~noble_arm64.deb

Source

pig build get pgml; # get pgml source code
pig build dep pgml; # install build dependencies
pig build pkg pgml; # build extension rpm or deb
pig build ext pgml; # build extension rpms

Install

To add the required PGDG / PIGSTY upstream repository, use:

pig repo add pgsql -u   # add PGDG + Pigsty repo and update cache (leave existing repos)

Install this extension with:

pig ext install pgml; # install by extension name, for the current active PG version
pig ext install pgml; # install via package alias, for the active PG version
pig ext install pgml -v 17;   # install for PG 17
pig ext install pgml -v 16;   # install for PG 16
pig ext install pgml -v 15;   # install for PG 15
pig ext install pgml -v 14;   # install for PG 14

Create this extension with:

CREATE EXTENSION pgml CASCADE SCHEMA pgml;

Usage

The PGML team seems not maintaining this extension for a while.

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