pgml
PostgresML:用SQL运行机器学习算法并训练模型
仓库
postgresml/postgresml
https://github.com/postgresml/postgresml
源码
pgml-2.10.0.tar.gz
pgml-2.10.0.tar.gz
概览
| 扩展包名 | 版本 | 分类 | 许可证 | 语言 |
|---|---|---|---|---|
pgml | 2.10.0 | RAG | MIT | Rust |
| ID | 扩展名 | Bin | Lib | Load | Create | Trust | Reloc | 模式 |
|---|---|---|---|---|---|---|---|---|
| 1890 | pgml | 否 | 是 | 是 | 是 | 否 | 否 | pgml |
| 相关扩展 | pg4ml vectorize pg_summarize pg_tiktoken vector vchord vectorscale pg_strom |
|---|
pgrx=0.12.9
版本
| 类型 | 仓库 | 版本 | PG 大版本 | 包名 | 依赖 |
|---|---|---|---|---|---|
| EXT | PIGSTY | 2.10.0 | 1817161514 | pgml | - |
| RPM | PIGSTY | 2.10.0 | 1817161514 | pgml_$v | - |
| DEB | PIGSTY | 2.10.0 | 1817161514 | postgresql-$v-pgml | - |
| OS / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PIGSTY MISS | PIGSTY 2.10.0 el8.x86_64.pg17 : pgml_17 pgml_17-2.10.0-1PIGSTY.el8.x86_64.rpm
| PIGSTY 2.10.0 el8.x86_64.pg16 : pgml_16 pgml_16-2.10.0-1PIGSTY.el8.x86_64.rpm
| PIGSTY 2.10.0 el8.x86_64.pg15 : pgml_15 pgml_15-2.10.0-1PIGSTY.el8.x86_64.rpm
| PIGSTY 2.10.0 el8.x86_64.pg14 : pgml_14 pgml_14-2.10.0-1PIGSTY.el8.x86_64.rpm
|
| el8.aarch64 | PIGSTY MISS | PIGSTY 2.10.0 el8.aarch64.pg17 : pgml_17 pgml_17-2.10.0-1PIGSTY.el8.aarch64.rpm
| PIGSTY 2.10.0 el8.aarch64.pg16 : pgml_16 pgml_16-2.10.0-1PIGSTY.el8.aarch64.rpm
| PIGSTY 2.10.0 el8.aarch64.pg15 : pgml_15 pgml_15-2.10.0-1PIGSTY.el8.aarch64.rpm
| PIGSTY 2.10.0 el8.aarch64.pg14 : pgml_14 pgml_14-2.10.0-1PIGSTY.el8.aarch64.rpm
|
| el9.x86_64 | PIGSTY MISS | PIGSTY 2.10.0 el9.x86_64.pg17 : pgml_17 pgml_17-2.10.0-1PIGSTY.el9.x86_64.rpm
| PIGSTY 2.10.0 el9.x86_64.pg16 : pgml_16 pgml_16-2.10.0-1PIGSTY.el9.x86_64.rpm
| PIGSTY 2.10.0 el9.x86_64.pg15 : pgml_15 pgml_15-2.10.0-1PIGSTY.el9.x86_64.rpm
| PIGSTY 2.10.0 el9.x86_64.pg14 : pgml_14 pgml_14-2.10.0-1PIGSTY.el9.x86_64.rpm
|
| el9.aarch64 | PIGSTY MISS | PIGSTY 2.10.0 el9.aarch64.pg17 : pgml_17 pgml_17-2.10.0-1PIGSTY.el9.aarch64.rpm
| PIGSTY 2.10.0 el9.aarch64.pg16 : pgml_16 pgml_16-2.10.0-1PIGSTY.el9.aarch64.rpm
| PIGSTY 2.10.0 el9.aarch64.pg15 : pgml_15 pgml_15-2.10.0-1PIGSTY.el9.aarch64.rpm
| PIGSTY 2.10.0 el9.aarch64.pg14 : pgml_14 pgml_14-2.10.0-1PIGSTY.el9.aarch64.rpm
|
| el10.x86_64 | PIGSTY MISS | PIGSTY MISS | PIGSTY MISS | PIGSTY MISS | PIGSTY MISS |
| el10.aarch64 | PIGSTY MISS | PIGSTY MISS | PIGSTY MISS | PIGSTY MISS | PIGSTY MISS |
| d12.x86_64 | PIGSTY MISS | PIGSTY 2.10.0 d12.x86_64.pg17 : postgresql-17-pgml postgresql-17-pgml_2.10.0-1PIGSTY~bookworm_amd64.deb
| PIGSTY 2.10.0 d12.x86_64.pg16 : postgresql-16-pgml postgresql-16-pgml_2.10.0-1PIGSTY~bookworm_amd64.deb
| PIGSTY 2.10.0 d12.x86_64.pg15 : postgresql-15-pgml postgresql-15-pgml_2.10.0-1PIGSTY~bookworm_amd64.deb
| PIGSTY 2.10.0 d12.x86_64.pg14 : postgresql-14-pgml postgresql-14-pgml_2.10.0-1PIGSTY~bookworm_amd64.deb
|
| d12.aarch64 | PIGSTY MISS | PIGSTY 2.10.0 d12.aarch64.pg17 : postgresql-17-pgml postgresql-17-pgml_2.10.0-1PIGSTY~bookworm_arm64.deb
| PIGSTY 2.10.0 d12.aarch64.pg16 : postgresql-16-pgml postgresql-16-pgml_2.10.0-1PIGSTY~bookworm_arm64.deb
| PIGSTY 2.10.0 d12.aarch64.pg15 : postgresql-15-pgml postgresql-15-pgml_2.10.0-1PIGSTY~bookworm_arm64.deb
| PIGSTY 2.10.0 d12.aarch64.pg14 : postgresql-14-pgml postgresql-14-pgml_2.10.0-1PIGSTY~bookworm_arm64.deb
|
| d13.x86_64 | PIGSTY MISS | PIGSTY MISS | PIGSTY MISS | PIGSTY MISS | PIGSTY MISS |
| d13.aarch64 | PIGSTY MISS | PIGSTY MISS | PIGSTY MISS | PIGSTY MISS | PIGSTY MISS |
| u22.x86_64 | PIGSTY MISS | PIGSTY 2.10.0 u22.x86_64.pg17 : postgresql-17-pgml postgresql-17-pgml_2.10.0-1PIGSTY~jammy_amd64.deb
| PIGSTY 2.10.0 u22.x86_64.pg16 : postgresql-16-pgml postgresql-16-pgml_2.10.0-1PIGSTY~jammy_amd64.deb
| PIGSTY 2.10.0 u22.x86_64.pg15 : postgresql-15-pgml postgresql-15-pgml_2.10.0-1PIGSTY~jammy_amd64.deb
| PIGSTY 2.10.0 u22.x86_64.pg14 : postgresql-14-pgml postgresql-14-pgml_2.10.0-1PIGSTY~jammy_amd64.deb
|
| u22.aarch64 | PIGSTY MISS | PIGSTY 2.10.0 u22.aarch64.pg17 : postgresql-17-pgml postgresql-17-pgml_2.10.0-1PIGSTY~jammy_arm64.deb
| PIGSTY 2.10.0 u22.aarch64.pg16 : postgresql-16-pgml postgresql-16-pgml_2.10.0-1PIGSTY~jammy_arm64.deb
| PIGSTY 2.10.0 u22.aarch64.pg15 : postgresql-15-pgml postgresql-15-pgml_2.10.0-1PIGSTY~jammy_arm64.deb
| PIGSTY 2.10.0 u22.aarch64.pg14 : postgresql-14-pgml postgresql-14-pgml_2.10.0-1PIGSTY~jammy_arm64.deb
|
| u24.x86_64 | PIGSTY MISS | PIGSTY 2.10.0 u24.x86_64.pg17 : postgresql-17-pgml postgresql-17-pgml_2.10.0-1PIGSTY~noble_amd64.deb
| PIGSTY 2.10.0 u24.x86_64.pg16 : postgresql-16-pgml postgresql-16-pgml_2.10.0-1PIGSTY~noble_amd64.deb
| PIGSTY 2.10.0 u24.x86_64.pg15 : postgresql-15-pgml postgresql-15-pgml_2.10.0-1PIGSTY~noble_amd64.deb
| PIGSTY 2.10.0 u24.x86_64.pg14 : postgresql-14-pgml postgresql-14-pgml_2.10.0-1PIGSTY~noble_amd64.deb
|
| u24.aarch64 | PIGSTY MISS | PIGSTY 2.10.0 u24.aarch64.pg17 : postgresql-17-pgml postgresql-17-pgml_2.10.0-1PIGSTY~noble_arm64.deb
| PIGSTY 2.10.0 u24.aarch64.pg16 : postgresql-16-pgml postgresql-16-pgml_2.10.0-1PIGSTY~noble_arm64.deb
| PIGSTY 2.10.0 u24.aarch64.pg15 : postgresql-15-pgml postgresql-15-pgml_2.10.0-1PIGSTY~noble_arm64.deb
| PIGSTY 2.10.0 u24.aarch64.pg14 : postgresql-14-pgml postgresql-14-pgml_2.10.0-1PIGSTY~noble_arm64.deb
|
构建
您可以使用 pig build 命令构建 pgml 扩展的 RPM / DEB 包:
pig build pkg pgml # 构建 RPM / DEB 包
安装
您可以直接安装 pgml 扩展包的预置二进制包,首先确保 PGDG 和 PIGSTY 仓库已经添加并启用:
pig repo add pgsql -u # 添加仓库并更新缓存
使用 pig 或者是 apt/yum/dnf 安装扩展:
pig install pgml; # 当前活跃 PG 版本安装
pig ext install -y pgml -v 17 # PG 17
pig ext install -y pgml -v 16 # PG 16
pig ext install -y pgml -v 15 # PG 15
pig ext install -y pgml -v 14 # PG 14
dnf install -y pgml_17 # PG 17
dnf install -y pgml_16 # PG 16
dnf install -y pgml_15 # PG 15
dnf install -y pgml_14 # PG 14
apt install -y postgresql-17-pgml # PG 17
apt install -y postgresql-16-pgml # PG 16
apt install -y postgresql-15-pgml # PG 15
apt install -y postgresql-14-pgml # PG 14
预加载配置:
shared_preload_libraries = 'pgml';
创建扩展:
CREATE EXTENSION pgml;
用法
该扩展缺乏维护
在所有集群节点上安装 pgml 扩展及 Python 依赖后,即可在 PostgreSQL 集群中启用 pgml。
使用 patronictl 命令配置集群,将 pgml 添加到 shared_preload_libraries 中,并在 pgml.venv 中指定 venv 目录:
shared_preload_libraries: pgml, timescaledb, pg_stat_statements, auto_explain
pgml.venv: '/data/pgml'
完成后,重启数据库集群,然后使用 SQL 命令创建扩展:
CREATE EXTENSION vector; -- 建议同时安装 pgvector!
CREATE EXTENSION pgml; -- 在当前数据库中创建 PostgresML
SELECT pgml.version(); -- 打印 PostgresML 版本信息
如果一切正常,应当看到类似如下的输出:
# 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(); -- 打印 PostgresML 版本信息
version
---------
2.7.8
一切就绪!更多详情请参阅 PostgresML 官方文档:https://postgresml.org/docs/guides/use-cases/