pgml
PostgresML:用SQL运行机器学习算法并训练模型
Module:
Categories:
扩展总览
PIGSTY 第三方扩展: pgml
: PostgresML:用SQL运行机器学习算法并训练模型
基本信息
- 扩展编号: 1890
- 扩展名称:
pgml
- 标准包名:
pgml
- 扩展类目:
RAG
- 开源协议: MIT
- 官方网站: https://github.com/postgresml/postgresml
- 编程语言: Rust
- 其他标签:
pgrx
- 备注信息: 无
元数据
- 默认版本: 2.10.0
- PG大版本:
17
,16
,15
,14
- 动态加载: 需要显式加载
- 需要DDL: 需要执行
CREATE EXTENSION
DDL - 可重定位: 可以重定位安装至其他模式下
- 信任程度: 未受信任,创建扩展需要超级用户权限
- 所需模式:
pgml
- 所需扩展: 无
软件包
- RPM仓库:None
- RPM包名:无
- RPM版本:无
- RPM依赖:无
- DEB仓库:PIGSTY
- DEB包名:
postgresql-$v-pgml
- DEB版本:
2.10.0
- DEB依赖:无
最新版本
系统 | 架构 | PG17 | PG16 | PG15 | PG14 | PG13 |
---|---|---|---|---|---|---|
el8 |
x86_64 |
|||||
el8 |
aarch64 |
|||||
el9 |
x86_64 |
|||||
el9 |
aarch64 |
|||||
d12 |
x86_64 |
postgresql-17-pgml PIGSTY 2.10.0 |
postgresql-16-pgml PIGSTY 2.10.0 |
postgresql-15-pgml PIGSTY 2.10.0 |
postgresql-14-pgml PIGSTY 2.10.0 |
postgresql-13-pgml PIGSTY 2.10.0 |
d12 |
aarch64 |
postgresql-17-pgml PIGSTY 2.10.0 |
postgresql-16-pgml PIGSTY 2.10.0 |
postgresql-15-pgml PIGSTY 2.10.0 |
postgresql-14-pgml PIGSTY 2.10.0 |
postgresql-13-pgml PIGSTY 2.10.0 |
u22 |
x86_64 |
postgresql-17-pgml PIGSTY 2.10.0 |
postgresql-16-pgml PIGSTY 2.10.0 |
postgresql-15-pgml PIGSTY 2.10.0 |
postgresql-14-pgml PIGSTY 2.10.0 |
postgresql-13-pgml PIGSTY 2.10.0 |
u22 |
aarch64 |
postgresql-17-pgml PIGSTY 2.10.0 |
postgresql-16-pgml PIGSTY 2.10.0 |
postgresql-15-pgml PIGSTY 2.10.0 |
postgresql-14-pgml PIGSTY 2.10.0 |
postgresql-13-pgml PIGSTY 2.10.0 |
u24 |
x86_64 |
postgresql-17-pgml PIGSTY 2.10.0 |
postgresql-16-pgml PIGSTY 2.10.0 |
postgresql-15-pgml PIGSTY 2.10.0 |
postgresql-14-pgml PIGSTY 2.10.0 |
postgresql-13-pgml PIGSTY 2.10.0 |
u24 |
aarch64 |
postgresql-17-pgml PIGSTY 2.10.0 |
postgresql-16-pgml PIGSTY 2.10.0 |
postgresql-15-pgml PIGSTY 2.10.0 |
postgresql-14-pgml PIGSTY 2.10.0 |
postgresql-13-pgml PIGSTY 2.10.0 |
扩展安装
使用 pig
命令行工具安装 pgml
扩展:
pig ext install pgml
使用 Pigsty剧本 安装 pgml 扩展:
./pgsql.yml -t pg_extension -e '{"pg_extensions": ["pgml"]}' # -l <集群名>
apt install postgresql-17-pgml;
apt install postgresql-16-pgml;
apt install postgresql-15-pgml;
apt install postgresql-14-pgml;
扩展 pgml
需要通过 shared_preload_libraries
进行 动态加载:
shared_preload_libraries = 'pgml'; # 修改 PG 集群配置
使用以下 SQL 命令在已经安装此扩展插件的 PG 集群上 启用 pgml
扩展:
CREATE EXTENSION pgml;
使用方法
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/