这是本节的多页打印视图。 点击此处打印.

返回本页常规视图.

类目:RAG

AI与RAG扩展插件:向量数据库,DiskANN 向量索引,相似度度量函数集,库内机器学习与推理 pgml,等等。

RAG 类目共有 10 个可用扩展:

扩展名(详情) 标准名(官网) 仓库 版本 类目 许可证 LOAD DDL TRUST RELOC 简介
vector pgvector PGDG 0.8.0 RAG PostgreSQL 向量数据类型和 ivfflat / hnsw 访问方法
vchord vchord PIGSTY 0.2.2 RAG AGPLv3 使用Rust重写的高性能向量扩展
vectorscale pgvectorscale PIGSTY 0.6.0 RAG PostgreSQL 使用DiskANN算法对向量进行高效索引
vectorize pg_vectorize PIGSTY 0.21.1 RAG PostgreSQL 在PostgreSQL中封装RAG向量检索服务
pg_similarity pg_similarity MIXED 1.0 RAG BSD 3 提供17种距离度量函数
smlar smlar PIGSTY 1.0 RAG PostgreSQL 高效的相似度搜索函数
pg_summarize pg_summarize PIGSTY 0.0.1 RAG PostgreSQL 使用LLM对文本字段进行总结
pg_tiktoken pg_tiktoken PIGSTY 0.0.1 RAG Apache-2.0 在PostgreSQL中计算OpenAI使用的Token数
pg4ml pg4ml PIGSTY 2.0 RAG AGPLv3 PG4ML是一个机器学习框架
pgml pgml PIGSTY 2.10.0 RAG MIT PostgresML:用SQL运行机器学习算法并训练模型

1 - vector

向量数据类型和 ivfflat / hnsw 访问方法

扩展总览

PGDG 第一方扩展: pgvector : 向量数据类型和 ivfflat / hnsw 访问方法

基本信息

元数据

  • 默认版本: 0.8.0
  • PG大版本: 17,16,15,14,13
  • 动态加载: 无需动态加载
  • 需要DDL: 需要执行 CREATE EXTENSION DDL
  • 可重定位: 无法安装至任意模式下
  • 信任程度: 未受信任,创建扩展需要超级用户权限
  • 所需模式: 无
  • 所需扩展: 无

软件包

  • RPM仓库:PGDG
  • RPM包名:pgvector_$v*
  • RPM版本:0.8.0
  • RPM依赖:无
  • DEB仓库:PGDG
  • DEB包名:postgresql-$v-pgvector
  • DEB版本:0.8.0
  • DEB依赖:无

最新版本

系统 架构 PG17 PG16 PG15 PG14 PG13
el8 x86_64 pgvector_17
PGDG 0.8.0
pgvector_16
PGDG 0.8.0
pgvector_15
PGDG 0.8.0
pgvector_14
PGDG 0.8.0
pgvector_13
PGDG 0.8.0
el8 aarch64 pgvector_17
PGDG 0.8.0
pgvector_16
PGDG 0.8.0
pgvector_15
PGDG 0.8.0
pgvector_14
PGDG 0.8.0
pgvector_13
PGDG 0.8.0
el9 x86_64 pgvector_17
PGDG 0.8.0
pgvector_16
PGDG 0.8.0
pgvector_15
PGDG 0.8.0
pgvector_14
PGDG 0.8.0
pgvector_13
PGDG 0.8.0
el9 aarch64 pgvector_17
PGDG 0.8.0
pgvector_16
PGDG 0.8.0
pgvector_15
PGDG 0.8.0
pgvector_14
PGDG 0.8.0
pgvector_13
PGDG 0.8.0
d12 x86_64 postgresql-17-pgvector
PGDG 0.8.0
postgresql-16-pgvector
PGDG 0.8.0
postgresql-15-pgvector
PGDG 0.8.0
postgresql-14-pgvector
PGDG 0.8.0
postgresql-13-pgvector
PGDG 0.8.0
d12 aarch64 postgresql-17-pgvector
PGDG 0.8.0
postgresql-16-pgvector
PGDG 0.8.0
postgresql-15-pgvector
PGDG 0.8.0
postgresql-14-pgvector
PGDG 0.8.0
postgresql-13-pgvector
PGDG 0.8.0
u22 x86_64 postgresql-17-pgvector
PGDG 0.8.0
postgresql-16-pgvector
PGDG 0.8.0
postgresql-15-pgvector
PGDG 0.8.0
postgresql-14-pgvector
PGDG 0.8.0
postgresql-13-pgvector
PGDG 0.8.0
u22 aarch64 postgresql-17-pgvector
PGDG 0.8.0
postgresql-16-pgvector
PGDG 0.8.0
postgresql-15-pgvector
PGDG 0.8.0
postgresql-14-pgvector
PGDG 0.8.0
postgresql-13-pgvector
PGDG 0.8.0
u24 x86_64 postgresql-17-pgvector
PGDG 0.8.0
postgresql-16-pgvector
PGDG 0.8.0
postgresql-15-pgvector
PGDG 0.8.0
postgresql-14-pgvector
PGDG 0.8.0
postgresql-13-pgvector
PGDG 0.8.0
u24 aarch64 postgresql-17-pgvector
PGDG 0.8.0
postgresql-16-pgvector
PGDG 0.8.0
postgresql-15-pgvector
PGDG 0.8.0
postgresql-14-pgvector
PGDG 0.8.0
postgresql-13-pgvector
PGDG 0.8.0

扩展安装

使用 pig 命令行工具安装 pgvector 扩展:

pig ext install pgvector; # 扩展名称
pig ext install vector; # 标准包名

使用 Pigsty剧本 安装 pgvector 扩展:

./pgsql.yml -t pg_extension -e '{"pg_extensions": ["pgvector"]}' # -l <集群名>

YUM仓库 手工安装 pgvector RPM 包:

dnf install pgvector_17*;
dnf install pgvector_16*;
dnf install pgvector_15*;
dnf install pgvector_14*;
dnf install pgvector_13*;

APT仓库 手工安装 pgvector DEB 包:

apt install postgresql-17-pgvector;
apt install postgresql-16-pgvector;
apt install postgresql-15-pgvector;
apt install postgresql-14-pgvector;
apt install postgresql-13-pgvector;

使用以下 SQL 命令在已经安装此扩展插件的 PG 集群上 启用 vector 扩展:

CREATE EXTENSION vector;



2 - vchord

使用Rust重写的高性能向量扩展

扩展总览

PIGSTY 第三方扩展: vchord : 使用Rust重写的高性能向量扩展

基本信息

元数据

  • 默认版本: 0.2.2
  • PG大版本: 17,16,15,14
  • 动态加载: 需要显式加载
  • 需要DDL: 需要执行 CREATE EXTENSION DDL
  • 可重定位: 无法安装至任意模式下
  • 信任程度: 未受信任,创建扩展需要超级用户权限
  • 所需模式: 无
  • 所需扩展: vector

软件包

  • RPM仓库:PIGSTY
  • RPM包名:vchord_$v
  • RPM版本:0.2.1
  • RPM依赖:pgvector_$v
  • DEB仓库:PIGSTY
  • DEB包名:postgresql-$v-vchord
  • DEB版本:0.2.1
  • DEB依赖:postgresql-$v-pgvector

最新版本

系统 架构 PG17 PG16 PG15 PG14 PG13
el8 x86_64 vchord_17
PIGSTY 0.2.2
vchord_16
PIGSTY 0.2.2
vchord_15
PIGSTY 0.2.2
vchord_14
PIGSTY 0.2.2
el8 aarch64 vchord_17
PIGSTY 0.2.2
vchord_16
PIGSTY 0.2.2
vchord_15
PIGSTY 0.2.2
vchord_14
PIGSTY 0.2.2
el9 x86_64 vchord_17
PIGSTY 0.2.2
vchord_16
PIGSTY 0.2.2
vchord_15
PIGSTY 0.2.2
vchord_14
PIGSTY 0.2.2
el9 aarch64 vchord_17
PIGSTY 0.2.2
vchord_16
PIGSTY 0.2.2
vchord_15
PIGSTY 0.2.2
vchord_14
PIGSTY 0.2.2
d12 x86_64 postgresql-17-vchord
PIGSTY 0.2.2
postgresql-16-vchord
PIGSTY 0.2.2
postgresql-15-vchord
PIGSTY 0.2.2
postgresql-14-vchord
PIGSTY 0.2.2
d12 aarch64 postgresql-17-vchord
PIGSTY 0.2.2
postgresql-16-vchord
PIGSTY 0.2.2
postgresql-15-vchord
PIGSTY 0.2.2
postgresql-14-vchord
PIGSTY 0.2.2
u22 x86_64 postgresql-17-vchord
PIGSTY 0.2.2
postgresql-16-vchord
PIGSTY 0.2.2
postgresql-15-vchord
PIGSTY 0.2.2
postgresql-14-vchord
PIGSTY 0.2.2
u22 aarch64 postgresql-17-vchord
PIGSTY 0.2.2
postgresql-16-vchord
PIGSTY 0.2.2
postgresql-15-vchord
PIGSTY 0.2.2
postgresql-14-vchord
PIGSTY 0.2.2
u24 x86_64 postgresql-17-vchord
PIGSTY 0.2.2
postgresql-16-vchord
PIGSTY 0.2.2
postgresql-15-vchord
PIGSTY 0.2.2
postgresql-14-vchord
PIGSTY 0.2.2
u24 aarch64 postgresql-17-vchord
PIGSTY 0.2.2
postgresql-16-vchord
PIGSTY 0.2.2
postgresql-15-vchord
PIGSTY 0.2.2
postgresql-14-vchord
PIGSTY 0.2.2

扩展安装

使用 pig 命令行工具安装 vchord 扩展:

pig ext install vchord

使用 Pigsty剧本 安装 vchord 扩展:

./pgsql.yml -t pg_extension -e '{"pg_extensions": ["vchord"]}' # -l <集群名>

YUM仓库 手工安装 vchord RPM 包:

dnf install vchord_17;
dnf install vchord_16;
dnf install vchord_15;
dnf install vchord_14;

APT仓库 手工安装 vchord DEB 包:

apt install postgresql-17-vchord;
apt install postgresql-16-vchord;
apt install postgresql-15-vchord;
apt install postgresql-14-vchord;

扩展 vchord 需要通过 shared_preload_libraries 进行 动态加载

shared_preload_libraries = 'vchord'; # 修改 PG 集群配置

使用以下 SQL 命令在已经安装此扩展插件的 PG 集群上 启用 vchord 扩展:

CREATE EXTENSION vchord CASCADE;

使用方法

Add this extension to shared_preload_libraries in postgresql.conf

CREATE EXTENSION vchord CASCADE;

Create Index on embedding:

CREATE INDEX ON gist_train USING vchordrq (embedding vector_l2_ops) WITH (options = $$
residual_quantization = true
[build.internal]
lists = [4096]
spherical_centroids = false
$$);

Docs

Query

The query statement is exactly the same as pgvector. VectorChord supports any filter operation and WHERE/JOIN clauses like pgvecto.rs with VBASE.

SELECT * FROM items ORDER BY embedding <-> '[3,1,2]' LIMIT 5;

Supported distance functions are:

  • <-> - L2 distance
  • <#> - (negative) inner product
  • <=> - cosine distance

Query Performance Tuning

You can fine-tune the search performance by adjusting the probes and epsilon parameters:

-- Set probes to control the number of lists scanned. 
-- Recommended range: 3%–10% of the total `lists` value.
SET vchordrq.probes = 100;

-- Set epsilon to control the reranking precision.
-- Larger value means more rerank for higher recall rate.
-- Don't change it unless you only have limited memory.
-- Recommended range: 1.0–1.9. Default value is 1.9.
SET vchordrq.epsilon = 1.9;

-- vchordrq relies on a projection matrix to optimize performance.
-- Add your vector dimensions to the `prewarm_dim` list to reduce latency.
-- If this is not configured, the first query will have higher latency as the matrix is generated on demand.
-- Default value: '64,128,256,384,512,768,1024,1536'
-- Note: This setting requires a database restart to take effect.
ALTER SYSTEM SET vchordrq.prewarm_dim = '64,128,256,384,512,768,1024,1536';

And for postgres’s setting

-- If using SSDs, set `effective_io_concurrency` to 200 for faster disk I/O.
SET effective_io_concurrency = 200;

-- Disable JIT (Just-In-Time Compilation) as it offers minimal benefit (1–2%) 
-- and adds overhead for single-query workloads.
SET jit = off;

-- Allocate at least 25% of total memory to `shared_buffers`. 
-- For disk-heavy workloads, you can increase this to up to 90% of total memory. You may also want to disable swap with network storage to avoid io hang.
-- Note: A restart is required for this setting to take effect.
ALTER SYSTEM SET shared_buffers = '8GB';

Indexing prewarm

To prewarm the index, you can use the following SQL. It will significantly improve performance when using limited memory.

-- vchordrq_prewarm(index_name::regclass) to prewarm the index into the shared buffer
SELECT vchordrq_prewarm('gist_train_embedding_idx'::regclass)"

Index Build Time

Index building can parallelized, and with external centroid precomputation, the total time is primarily limited by disk speed. Optimize parallelism using the following settings:

-- Set this to the number of CPU cores available for parallel operations.
SET max_parallel_maintenance_workers = 8;
SET max_parallel_workers = 8;

-- Adjust the total number of worker processes. 
-- Note: A restart is required for this setting to take effect.
ALTER SYSTEM SET max_worker_processes = 8;

Indexing Progress

You can check the indexing progress by querying the pg_stat_progress_create_index view.

SELECT phase, round(100.0 * blocks_done / nullif(blocks_total, 0), 1) AS "%" FROM pg_stat_progress_create_index;

External Index Precomputation

Unlike pure SQL, an external index precomputation will first do clustering outside and insert centroids to a PostgreSQL table. Although it might be more complicated, external build is definitely much faster on larger dataset (>5M).

To get started, you need to do a clustering of vectors using faiss, scikit-learn or any other clustering library.

The centroids should be preset in a table of any name with 3 columns:

  • id(integer): id of each centroid, should be unique
  • parent(integer, nullable): parent id of each centroid, should be NULL for normal clustering
  • vector(vector): representation of each centroid, pgvector vector type

And example could be like this:

-- Create table of centroids
CREATE TABLE public.centroids (id integer NOT NULL UNIQUE, parent integer, vector vector(768));
-- Insert centroids into it
INSERT INTO public.centroids (id, parent, vector) VALUES (1, NULL, '{0.1, 0.2, 0.3, ..., 0.768}');
INSERT INTO public.centroids (id, parent, vector) VALUES (2, NULL, '{0.4, 0.5, 0.6, ..., 0.768}');
INSERT INTO public.centroids (id, parent, vector) VALUES (3, NULL, '{0.7, 0.8, 0.9, ..., 0.768}');
-- ...

-- Create index using the centroid table
CREATE INDEX ON gist_train USING vchordrq (embedding vector_l2_ops) WITH (options = $$
[build.external]
table = 'public.centroids'
$$);

To simplify the workflow, we provide end-to-end scripts for external index pre-computation, see scripts.


Limitations

  • Data Type Support: Currently, only the f32 data type is supported for vectors.
  • Architecture Compatibility: The fast-scan kernel is optimized for x86_64 architectures. While it runs on aarch64, performance may be lower.
  • KMeans Clustering: The built-in KMeans clustering is not yet fully optimized and may require substantial memory. We strongly recommend using external centroid precomputation for efficient index construction.



3 - vectorscale

使用DiskANN算法对向量进行高效索引

扩展总览

PIGSTY 第三方扩展: pgvectorscale : 使用DiskANN算法对向量进行高效索引

基本信息

元数据

  • 默认版本: 0.6.0
  • PG大版本: 17,16,15,14,13
  • 动态加载: 无需动态加载
  • 需要DDL: 需要执行 CREATE EXTENSION DDL
  • 可重定位: 可以重定位安装至其他模式下
  • 信任程度: 未受信任,创建扩展需要超级用户权限
  • 所需模式: 无
  • 所需扩展: vector

软件包

  • RPM仓库:PIGSTY
  • RPM包名:pgvectorscale_$v
  • RPM版本:0.5.1
  • RPM依赖:无
  • DEB仓库:PIGSTY
  • DEB包名:postgresql-$v-pgvectorscale
  • DEB版本:0.5.1
  • DEB依赖:无

最新版本

系统 架构 PG17 PG16 PG15 PG14 PG13
el8 x86_64 pgvectorscale_17
PIGSTY 0.6.0
pgvectorscale_16
PIGSTY 0.6.0
pgvectorscale_15
PIGSTY 0.6.0
pgvectorscale_14
PIGSTY 0.6.0
pgvectorscale_13
PIGSTY 0.6.0
el8 aarch64 pgvectorscale_17
PIGSTY 0.6.0
pgvectorscale_16
PIGSTY 0.6.0
pgvectorscale_15
PIGSTY 0.6.0
pgvectorscale_14
PIGSTY 0.6.0
pgvectorscale_13
PIGSTY 0.6.0
el9 x86_64 pgvectorscale_17
PIGSTY 0.6.0
pgvectorscale_16
PIGSTY 0.6.0
pgvectorscale_15
PIGSTY 0.6.0
pgvectorscale_14
PIGSTY 0.6.0
pgvectorscale_13
PIGSTY 0.6.0
el9 aarch64 pgvectorscale_17
PIGSTY 0.6.0
pgvectorscale_16
PIGSTY 0.6.0
pgvectorscale_15
PIGSTY 0.6.0
pgvectorscale_14
PIGSTY 0.6.0
pgvectorscale_13
PIGSTY 0.6.0
d12 x86_64 postgresql-17-pgvectorscale
PIGSTY 0.6.0
postgresql-16-pgvectorscale
PIGSTY 0.6.0
postgresql-15-pgvectorscale
PIGSTY 0.6.0
postgresql-14-pgvectorscale
PIGSTY 0.6.0
postgresql-13-pgvectorscale
PIGSTY 0.6.0
d12 aarch64 postgresql-17-pgvectorscale
PIGSTY 0.6.0
postgresql-16-pgvectorscale
PIGSTY 0.6.0
postgresql-15-pgvectorscale
PIGSTY 0.6.0
postgresql-14-pgvectorscale
PIGSTY 0.6.0
postgresql-13-pgvectorscale
PIGSTY 0.6.0
u22 x86_64 postgresql-17-pgvectorscale
PIGSTY 0.6.0
postgresql-16-pgvectorscale
PIGSTY 0.6.0
postgresql-15-pgvectorscale
PIGSTY 0.6.0
postgresql-14-pgvectorscale
PIGSTY 0.6.0
postgresql-13-pgvectorscale
PIGSTY 0.6.0
u22 aarch64 postgresql-17-pgvectorscale
PIGSTY 0.6.0
postgresql-16-pgvectorscale
PIGSTY 0.6.0
postgresql-15-pgvectorscale
PIGSTY 0.6.0
postgresql-14-pgvectorscale
PIGSTY 0.6.0
postgresql-13-pgvectorscale
PIGSTY 0.6.0
u24 x86_64 postgresql-17-pgvectorscale
PIGSTY 0.6.0
postgresql-16-pgvectorscale
PIGSTY 0.6.0
postgresql-15-pgvectorscale
PIGSTY 0.6.0
postgresql-14-pgvectorscale
PIGSTY 0.6.0
postgresql-13-pgvectorscale
PIGSTY 0.6.0
u24 aarch64 postgresql-17-pgvectorscale
PIGSTY 0.6.0
postgresql-16-pgvectorscale
PIGSTY 0.6.0
postgresql-15-pgvectorscale
PIGSTY 0.6.0
postgresql-14-pgvectorscale
PIGSTY 0.6.0
postgresql-13-pgvectorscale
PIGSTY 0.6.0

扩展安装

使用 pig 命令行工具安装 pgvectorscale 扩展:

pig ext install pgvectorscale; # 扩展名称
pig ext install vectorscale; # 标准包名

使用 Pigsty剧本 安装 pgvectorscale 扩展:

./pgsql.yml -t pg_extension -e '{"pg_extensions": ["pgvectorscale"]}' # -l <集群名>

YUM仓库 手工安装 pgvectorscale RPM 包:

dnf install pgvectorscale_17;
dnf install pgvectorscale_16;
dnf install pgvectorscale_15;
dnf install pgvectorscale_14;
dnf install pgvectorscale_13;

APT仓库 手工安装 pgvectorscale DEB 包:

apt install postgresql-17-pgvectorscale;
apt install postgresql-16-pgvectorscale;
apt install postgresql-15-pgvectorscale;
apt install postgresql-14-pgvectorscale;
apt install postgresql-13-pgvectorscale;

使用以下 SQL 命令在已经安装此扩展插件的 PG 集群上 启用 vectorscale 扩展:

CREATE EXTENSION vectorscale CASCADE;



4 - vectorize

在PostgreSQL中封装RAG向量检索服务

扩展总览

PIGSTY 第三方扩展: pg_vectorize : 在PostgreSQL中封装RAG向量检索服务

基本信息

元数据

  • 默认版本: 0.21.1
  • PG大版本: 17,16,15,14
  • 动态加载: 无需动态加载
  • 需要DDL: 需要执行 CREATE EXTENSION DDL
  • 可重定位: 可以重定位安装至其他模式下
  • 信任程度: 未受信任,创建扩展需要超级用户权限
  • 所需模式: vectorize
  • 所需扩展: pg_cron, pgmq, vector

软件包

  • RPM仓库:PIGSTY
  • RPM包名:pg_vectorize_$v
  • RPM版本:0.21.1
  • RPM依赖:pgmq_$v, pg_cron_$v, pgvector_$v
  • DEB仓库:PIGSTY
  • DEB包名:postgresql-$v-pg-vectorize
  • DEB版本:0.21.1
  • DEB依赖:postgresql-$v-pgmq, postgresql-$v-pg-cron, postgresql-$v-pgvector

最新版本

系统 架构 PG17 PG16 PG15 PG14 PG13
el8 x86_64 pg_vectorize_17
PIGSTY 0.21.1
pg_vectorize_16
PIGSTY 0.21.1
pg_vectorize_15
PIGSTY 0.21.1
pg_vectorize_14
PIGSTY 0.21.1
el8 aarch64 pg_vectorize_17
PIGSTY 0.21.1
pg_vectorize_16
PIGSTY 0.21.1
pg_vectorize_15
PIGSTY 0.21.1
pg_vectorize_14
PIGSTY 0.21.1
el9 x86_64 pg_vectorize_17
PIGSTY 0.21.1
pg_vectorize_16
PIGSTY 0.21.1
pg_vectorize_15
PIGSTY 0.21.1
pg_vectorize_14
PIGSTY 0.21.1
el9 aarch64 pg_vectorize_17
PIGSTY 0.21.1
pg_vectorize_16
PIGSTY 0.21.1
pg_vectorize_15
PIGSTY 0.21.1
pg_vectorize_14
PIGSTY 0.21.1
d12 x86_64 postgresql-17-pg-vectorize
PIGSTY 0.21.1
postgresql-16-pg-vectorize
PIGSTY 0.21.1
postgresql-15-pg-vectorize
PIGSTY 0.21.1
postgresql-14-pg-vectorize
PIGSTY 0.21.1
d12 aarch64 postgresql-17-pg-vectorize
PIGSTY 0.21.1
postgresql-16-pg-vectorize
PIGSTY 0.21.1
postgresql-15-pg-vectorize
PIGSTY 0.21.1
postgresql-14-pg-vectorize
PIGSTY 0.21.1
u22 x86_64 postgresql-17-pg-vectorize
PIGSTY 0.21.1
postgresql-16-pg-vectorize
PIGSTY 0.21.1
postgresql-15-pg-vectorize
PIGSTY 0.21.1
postgresql-14-pg-vectorize
PIGSTY 0.21.1
u22 aarch64 postgresql-17-pg-vectorize
PIGSTY 0.21.1
postgresql-16-pg-vectorize
PIGSTY 0.21.1
postgresql-15-pg-vectorize
PIGSTY 0.21.1
postgresql-14-pg-vectorize
PIGSTY 0.21.1
u24 x86_64 postgresql-17-pg-vectorize
PIGSTY 0.21.1
postgresql-16-pg-vectorize
PIGSTY 0.21.1
postgresql-15-pg-vectorize
PIGSTY 0.21.1
postgresql-14-pg-vectorize
PIGSTY 0.21.1
u24 aarch64 postgresql-17-pg-vectorize
PIGSTY 0.21.1
postgresql-16-pg-vectorize
PIGSTY 0.21.1
postgresql-15-pg-vectorize
PIGSTY 0.21.1
postgresql-14-pg-vectorize
PIGSTY 0.21.1

扩展安装

使用 pig 命令行工具安装 pg_vectorize 扩展:

pig ext install pg_vectorize; # 扩展名称
pig ext install vectorize; # 标准包名

使用 Pigsty剧本 安装 pg_vectorize 扩展:

./pgsql.yml -t pg_extension -e '{"pg_extensions": ["pg_vectorize"]}' # -l <集群名>

YUM仓库 手工安装 pg_vectorize RPM 包:

dnf install pg_vectorize_17;
dnf install pg_vectorize_16;
dnf install pg_vectorize_15;
dnf install pg_vectorize_14;

APT仓库 手工安装 pg_vectorize DEB 包:

apt install postgresql-17-pg-vectorize;
apt install postgresql-16-pg-vectorize;
apt install postgresql-15-pg-vectorize;
apt install postgresql-14-pg-vectorize;

使用以下 SQL 命令在已经安装此扩展插件的 PG 集群上 启用 vectorize 扩展:

CREATE EXTENSION vectorize CASCADE;



5 - pg_similarity

提供17种距离度量函数

扩展总览

MIXED 第三方扩展: pg_similarity : 提供17种距离度量函数

基本信息

元数据

  • 默认版本: 1.0
  • PG大版本: 17,16,15,14,13
  • 动态加载: 无需动态加载
  • 需要DDL: 需要执行 CREATE EXTENSION DDL
  • 可重定位: 无法安装至任意模式下
  • 信任程度: 未受信任,创建扩展需要超级用户权限
  • 所需模式: 无
  • 所需扩展: 无

软件包

  • RPM仓库:PIGSTY
  • RPM包名:pg_similarity_$v*
  • RPM版本:1.0
  • RPM依赖:无
  • DEB仓库:PGDG
  • DEB包名:postgresql-$v-similarity
  • DEB版本:1.0
  • DEB依赖:无

最新版本

系统 架构 PG17 PG16 PG15 PG14 PG13
el8 x86_64 pg_similarity_17
PIGSTY 1.0
pg_similarity_16
PIGSTY 1.0
pg_similarity_15
PIGSTY 1.0
pg_similarity_14
PIGSTY 1.0
pg_similarity_13
PIGSTY 1.0
el8 aarch64 pg_similarity_17
PIGSTY 1.0
pg_similarity_16
PIGSTY 1.0
pg_similarity_15
PIGSTY 1.0
pg_similarity_14
PIGSTY 1.0
pg_similarity_13
PIGSTY 1.0
el9 x86_64 pg_similarity_17
PIGSTY 1.0
pg_similarity_16
PIGSTY 1.0
pg_similarity_15
PIGSTY 1.0
pg_similarity_14
PIGSTY 1.0
pg_similarity_13
PIGSTY 1.0
el9 aarch64 pg_similarity_17
PIGSTY 1.0
pg_similarity_16
PIGSTY 1.0
pg_similarity_15
PIGSTY 1.0
pg_similarity_14
PIGSTY 1.0
pg_similarity_13
PIGSTY 1.0
d12 x86_64 postgresql-17-similarity
PGDG 1.0
postgresql-16-similarity
PGDG 1.0
postgresql-15-similarity
PGDG 1.0
postgresql-14-similarity
PGDG 1.0
postgresql-13-similarity
PGDG 1.0
d12 aarch64 postgresql-17-similarity
PGDG 1.0
postgresql-16-similarity
PGDG 1.0
postgresql-15-similarity
PGDG 1.0
postgresql-14-similarity
PGDG 1.0
postgresql-13-similarity
PGDG 1.0
u22 x86_64 postgresql-17-similarity
PGDG 1.0
postgresql-16-similarity
PGDG 1.0
postgresql-15-similarity
PGDG 1.0
postgresql-14-similarity
PGDG 1.0
postgresql-13-similarity
PGDG 1.0
u22 aarch64 postgresql-17-similarity
PGDG 1.0
postgresql-16-similarity
PGDG 1.0
postgresql-15-similarity
PGDG 1.0
postgresql-14-similarity
PGDG 1.0
postgresql-13-similarity
PGDG 1.0
u24 x86_64 postgresql-17-similarity
PGDG 1.0
postgresql-16-similarity
PGDG 1.0
postgresql-15-similarity
PGDG 1.0
postgresql-14-similarity
PGDG 1.0
postgresql-13-similarity
PGDG 1.0
u24 aarch64 postgresql-17-similarity
PGDG 1.0
postgresql-16-similarity
PGDG 1.0
postgresql-15-similarity
PGDG 1.0
postgresql-14-similarity
PGDG 1.0
postgresql-13-similarity
PGDG 1.0

扩展安装

使用 pig 命令行工具安装 pg_similarity 扩展:

pig ext install pg_similarity

使用 Pigsty剧本 安装 pg_similarity 扩展:

./pgsql.yml -t pg_extension -e '{"pg_extensions": ["pg_similarity"]}' # -l <集群名>

YUM仓库 手工安装 pg_similarity RPM 包:

dnf install pg_similarity_17*;
dnf install pg_similarity_16*;
dnf install pg_similarity_15*;
dnf install pg_similarity_14*;
dnf install pg_similarity_13*;

APT仓库 手工安装 pg_similarity DEB 包:

apt install postgresql-17-similarity;
apt install postgresql-16-similarity;
apt install postgresql-15-similarity;
apt install postgresql-14-similarity;
apt install postgresql-13-similarity;

使用以下 SQL 命令在已经安装此扩展插件的 PG 集群上 启用 pg_similarity 扩展:

CREATE EXTENSION pg_similarity;



6 - smlar

高效的相似度搜索函数

扩展总览

PIGSTY 第三方扩展: smlar : 高效的相似度搜索函数

基本信息

元数据

  • 默认版本: 1.0
  • PG大版本: 17,16,15,14,13
  • 动态加载: 无需动态加载
  • 需要DDL: 需要执行 CREATE EXTENSION DDL
  • 可重定位: 无法安装至任意模式下
  • 信任程度: 未知
  • 所需模式: 无
  • 所需扩展: 无

软件包

  • RPM仓库:PIGSTY
  • RPM包名:smlar_$v*
  • RPM版本:1.0
  • RPM依赖:无
  • DEB仓库:PIGSTY
  • DEB包名:postgresql-$v-smlar
  • DEB版本:1.0
  • DEB依赖:无

最新版本

系统 架构 PG17 PG16 PG15 PG14 PG13
el8 x86_64 smlar_17
PIGSTY 1.0
smlar_16
PIGSTY 1.0
smlar_15
PIGSTY 1.0
smlar_14
PIGSTY 1.0
smlar_13
PIGSTY 1.0
el8 aarch64 smlar_17
PIGSTY 1.0
smlar_16
PIGSTY 1.0
smlar_15
PIGSTY 1.0
smlar_14
PIGSTY 1.0
smlar_13
PIGSTY 1.0
el9 x86_64 smlar_17
PIGSTY 1.0
smlar_16
PIGSTY 1.0
smlar_15
PIGSTY 1.0
smlar_14
PIGSTY 1.0
smlar_13
PIGSTY 1.0
el9 aarch64 smlar_17
PIGSTY 1.0
smlar_16
PIGSTY 1.0
smlar_15
PIGSTY 1.0
smlar_14
PIGSTY 1.0
smlar_13
PIGSTY 1.0
d12 x86_64 postgresql-17-smlar
PIGSTY 1.0
postgresql-16-smlar
PIGSTY 1.0
postgresql-15-smlar
PIGSTY 1.0
postgresql-14-smlar
PIGSTY 1.0
postgresql-13-smlar
PIGSTY 1.0
d12 aarch64 postgresql-17-smlar
PIGSTY 1.0
postgresql-16-smlar
PIGSTY 1.0
postgresql-15-smlar
PIGSTY 1.0
postgresql-14-smlar
PIGSTY 1.0
postgresql-13-smlar
PIGSTY 1.0
u22 x86_64 postgresql-17-smlar
PIGSTY 1.0
postgresql-16-smlar
PIGSTY 1.0
postgresql-15-smlar
PIGSTY 1.0
postgresql-14-smlar
PIGSTY 1.0
postgresql-13-smlar
PIGSTY 1.0
u22 aarch64 postgresql-17-smlar
PIGSTY 1.0
postgresql-16-smlar
PIGSTY 1.0
postgresql-15-smlar
PIGSTY 1.0
postgresql-14-smlar
PIGSTY 1.0
postgresql-13-smlar
PIGSTY 1.0
u24 x86_64 postgresql-17-smlar
PIGSTY 1.0
postgresql-16-smlar
PIGSTY 1.0
postgresql-15-smlar
PIGSTY 1.0
postgresql-14-smlar
PIGSTY 1.0
postgresql-13-smlar
PIGSTY 1.0
u24 aarch64 postgresql-17-smlar
PIGSTY 1.0
postgresql-16-smlar
PIGSTY 1.0
postgresql-15-smlar
PIGSTY 1.0
postgresql-14-smlar
PIGSTY 1.0
postgresql-13-smlar
PIGSTY 1.0

扩展安装

使用 pig 命令行工具安装 smlar 扩展:

pig ext install smlar

使用 Pigsty剧本 安装 smlar 扩展:

./pgsql.yml -t pg_extension -e '{"pg_extensions": ["smlar"]}' # -l <集群名>

YUM仓库 手工安装 smlar RPM 包:

dnf install smlar_17*;
dnf install smlar_16*;
dnf install smlar_15*;
dnf install smlar_14*;
dnf install smlar_13*;

APT仓库 手工安装 smlar DEB 包:

apt install postgresql-17-smlar;
apt install postgresql-16-smlar;
apt install postgresql-15-smlar;
apt install postgresql-14-smlar;
apt install postgresql-13-smlar;

使用以下 SQL 命令在已经安装此扩展插件的 PG 集群上 启用 smlar 扩展:

CREATE EXTENSION smlar;



7 - pg_summarize

使用LLM对文本字段进行总结

扩展总览

PIGSTY 第三方扩展: pg_summarize : 使用LLM对文本字段进行总结

基本信息

元数据

  • 默认版本: 0.0.1
  • PG大版本: 17,16,15,14,13
  • 动态加载: 无需动态加载
  • 需要DDL: 需要执行 CREATE EXTENSION DDL
  • 可重定位: 可以重定位安装至其他模式下
  • 信任程度: 未受信任,创建扩展需要超级用户权限
  • 所需模式: 无
  • 所需扩展: 无

软件包

  • RPM仓库:PIGSTY
  • RPM包名:pg_summarize_$v
  • RPM版本:0.0.1
  • RPM依赖:无
  • DEB仓库:PIGSTY
  • DEB包名:postgresql-$v-pg-summarize
  • DEB版本:0.0.1
  • DEB依赖:无

最新版本

系统 架构 PG17 PG16 PG15 PG14 PG13
el8 x86_64 pg_summarize_17
PIGSTY 0.0.1
pg_summarize_16
PIGSTY 0.0.1
pg_summarize_15
PIGSTY 0.0.1
pg_summarize_14
PIGSTY 0.0.1
pg_summarize_13
PIGSTY 0.0.1
el8 aarch64 pg_summarize_17
PIGSTY 0.0.1
pg_summarize_16
PIGSTY 0.0.1
pg_summarize_15
PIGSTY 0.0.1
pg_summarize_14
PIGSTY 0.0.1
pg_summarize_13
PIGSTY 0.0.1
el9 x86_64 pg_summarize_17
PIGSTY 0.0.1
pg_summarize_16
PIGSTY 0.0.1
pg_summarize_15
PIGSTY 0.0.1
pg_summarize_14
PIGSTY 0.0.1
pg_summarize_13
PIGSTY 0.0.1
el9 aarch64 pg_summarize_17
PIGSTY 0.0.1
pg_summarize_16
PIGSTY 0.0.1
pg_summarize_15
PIGSTY 0.0.1
pg_summarize_14
PIGSTY 0.0.1
pg_summarize_13
PIGSTY 0.0.1
d12 x86_64 postgresql-17-pg-summarize
PIGSTY 0.0.1
postgresql-16-pg-summarize
PIGSTY 0.0.1
postgresql-15-pg-summarize
PIGSTY 0.0.1
postgresql-14-pg-summarize
PIGSTY 0.0.1
postgresql-13-pg-summarize
PIGSTY 0.0.1
d12 aarch64 postgresql-17-pg-summarize
PIGSTY 0.0.1
postgresql-16-pg-summarize
PIGSTY 0.0.1
postgresql-15-pg-summarize
PIGSTY 0.0.1
postgresql-14-pg-summarize
PIGSTY 0.0.1
postgresql-13-pg-summarize
PIGSTY 0.0.1
u22 x86_64 postgresql-17-pg-summarize
PIGSTY 0.0.1
postgresql-16-pg-summarize
PIGSTY 0.0.1
postgresql-15-pg-summarize
PIGSTY 0.0.1
postgresql-14-pg-summarize
PIGSTY 0.0.1
postgresql-13-pg-summarize
PIGSTY 0.0.1
u22 aarch64 postgresql-17-pg-summarize
PIGSTY 0.0.1
postgresql-16-pg-summarize
PIGSTY 0.0.1
postgresql-15-pg-summarize
PIGSTY 0.0.1
postgresql-14-pg-summarize
PIGSTY 0.0.1
postgresql-13-pg-summarize
PIGSTY 0.0.1
u24 x86_64 postgresql-17-pg-summarize
PIGSTY 0.0.1
postgresql-16-pg-summarize
PIGSTY 0.0.1
postgresql-15-pg-summarize
PIGSTY 0.0.1
postgresql-14-pg-summarize
PIGSTY 0.0.1
postgresql-13-pg-summarize
PIGSTY 0.0.1
u24 aarch64 postgresql-17-pg-summarize
PIGSTY 0.0.1
postgresql-16-pg-summarize
PIGSTY 0.0.1
postgresql-15-pg-summarize
PIGSTY 0.0.1
postgresql-14-pg-summarize
PIGSTY 0.0.1
postgresql-13-pg-summarize
PIGSTY 0.0.1

扩展安装

使用 pig 命令行工具安装 pg_summarize 扩展:

pig ext install pg_summarize

使用 Pigsty剧本 安装 pg_summarize 扩展:

./pgsql.yml -t pg_extension -e '{"pg_extensions": ["pg_summarize"]}' # -l <集群名>

YUM仓库 手工安装 pg_summarize RPM 包:

dnf install pg_summarize_17;
dnf install pg_summarize_16;
dnf install pg_summarize_15;
dnf install pg_summarize_14;
dnf install pg_summarize_13;

APT仓库 手工安装 pg_summarize DEB 包:

apt install postgresql-17-pg-summarize;
apt install postgresql-16-pg-summarize;
apt install postgresql-15-pg-summarize;
apt install postgresql-14-pg-summarize;
apt install postgresql-13-pg-summarize;

使用以下 SQL 命令在已经安装此扩展插件的 PG 集群上 启用 pg_summarize 扩展:

CREATE EXTENSION pg_summarize;



8 - pg_tiktoken

在PostgreSQL中计算OpenAI使用的Token数

扩展总览

PIGSTY 第三方扩展: pg_tiktoken : 在PostgreSQL中计算OpenAI使用的Token数

基本信息

元数据

  • 默认版本: 0.0.1
  • PG大版本: 17,16,15,14,13
  • 动态加载: 无需动态加载
  • 需要DDL: 需要执行 CREATE EXTENSION DDL
  • 可重定位: 可以重定位安装至其他模式下
  • 信任程度: 未受信任,创建扩展需要超级用户权限
  • 所需模式: 无
  • 所需扩展: 无

软件包

  • RPM仓库:PIGSTY
  • RPM包名:pg_tiktoken_$v
  • RPM版本:0.0.1
  • RPM依赖:无
  • DEB仓库:PIGSTY
  • DEB包名:postgresql-$v-pg-tiktoken
  • DEB版本:0.0.1
  • DEB依赖:无

最新版本

系统 架构 PG17 PG16 PG15 PG14 PG13
el8 x86_64 pg_tiktoken_17
PIGSTY 0.0.1
pg_tiktoken_16
PIGSTY 0.0.1
pg_tiktoken_15
PIGSTY 0.0.1
pg_tiktoken_14
PIGSTY 0.0.1
pg_tiktoken_13
PIGSTY 0.0.1
el8 aarch64 pg_tiktoken_17
PIGSTY 0.0.1
pg_tiktoken_16
PIGSTY 0.0.1
pg_tiktoken_15
PIGSTY 0.0.1
pg_tiktoken_14
PIGSTY 0.0.1
pg_tiktoken_13
PIGSTY 0.0.1
el9 x86_64 pg_tiktoken_17
PIGSTY 0.0.1
pg_tiktoken_16
PIGSTY 0.0.1
pg_tiktoken_15
PIGSTY 0.0.1
pg_tiktoken_14
PIGSTY 0.0.1
pg_tiktoken_13
PIGSTY 0.0.1
el9 aarch64 pg_tiktoken_17
PIGSTY 0.0.1
pg_tiktoken_16
PIGSTY 0.0.1
pg_tiktoken_15
PIGSTY 0.0.1
pg_tiktoken_14
PIGSTY 0.0.1
pg_tiktoken_13
PIGSTY 0.0.1
d12 x86_64 postgresql-17-pg-tiktoken
PIGSTY 0.0.1
postgresql-16-pg-tiktoken
PIGSTY 0.0.1
postgresql-15-pg-tiktoken
PIGSTY 0.0.1
postgresql-14-pg-tiktoken
PIGSTY 0.0.1
postgresql-13-pg-tiktoken
PIGSTY 0.0.1
d12 aarch64 postgresql-17-pg-tiktoken
PIGSTY 0.0.1
postgresql-16-pg-tiktoken
PIGSTY 0.0.1
postgresql-15-pg-tiktoken
PIGSTY 0.0.1
postgresql-14-pg-tiktoken
PIGSTY 0.0.1
postgresql-13-pg-tiktoken
PIGSTY 0.0.1
u22 x86_64 postgresql-17-pg-tiktoken
PIGSTY 0.0.1
postgresql-16-pg-tiktoken
PIGSTY 0.0.1
postgresql-15-pg-tiktoken
PIGSTY 0.0.1
postgresql-14-pg-tiktoken
PIGSTY 0.0.1
postgresql-13-pg-tiktoken
PIGSTY 0.0.1
u22 aarch64 postgresql-17-pg-tiktoken
PIGSTY 0.0.1
postgresql-16-pg-tiktoken
PIGSTY 0.0.1
postgresql-15-pg-tiktoken
PIGSTY 0.0.1
postgresql-14-pg-tiktoken
PIGSTY 0.0.1
postgresql-13-pg-tiktoken
PIGSTY 0.0.1
u24 x86_64 postgresql-17-pg-tiktoken
PIGSTY 0.0.1
postgresql-16-pg-tiktoken
PIGSTY 0.0.1
postgresql-15-pg-tiktoken
PIGSTY 0.0.1
postgresql-14-pg-tiktoken
PIGSTY 0.0.1
postgresql-13-pg-tiktoken
PIGSTY 0.0.1
u24 aarch64 postgresql-17-pg-tiktoken
PIGSTY 0.0.1
postgresql-16-pg-tiktoken
PIGSTY 0.0.1
postgresql-15-pg-tiktoken
PIGSTY 0.0.1
postgresql-14-pg-tiktoken
PIGSTY 0.0.1
postgresql-13-pg-tiktoken
PIGSTY 0.0.1

扩展安装

使用 pig 命令行工具安装 pg_tiktoken 扩展:

pig ext install pg_tiktoken

使用 Pigsty剧本 安装 pg_tiktoken 扩展:

./pgsql.yml -t pg_extension -e '{"pg_extensions": ["pg_tiktoken"]}' # -l <集群名>

YUM仓库 手工安装 pg_tiktoken RPM 包:

dnf install pg_tiktoken_17;
dnf install pg_tiktoken_16;
dnf install pg_tiktoken_15;
dnf install pg_tiktoken_14;
dnf install pg_tiktoken_13;

APT仓库 手工安装 pg_tiktoken DEB 包:

apt install postgresql-17-pg-tiktoken;
apt install postgresql-16-pg-tiktoken;
apt install postgresql-15-pg-tiktoken;
apt install postgresql-14-pg-tiktoken;
apt install postgresql-13-pg-tiktoken;

使用以下 SQL 命令在已经安装此扩展插件的 PG 集群上 启用 pg_tiktoken 扩展:

CREATE EXTENSION pg_tiktoken;



9 - pg4ml

PG4ML是一个机器学习框架

扩展总览

PIGSTY 第三方扩展: pg4ml : PG4ML是一个机器学习框架

基本信息

元数据

  • 默认版本: 2.0
  • PG大版本: 17,16,15,14,13
  • 动态加载: 无需动态加载
  • 需要DDL: 需要执行 CREATE EXTENSION DDL
  • 可重定位: 无法安装至任意模式下
  • 信任程度: 受信任,无需超级用户,带 CREATE 权限的用户可以直接创建
  • 所需模式: 无
  • 所需扩展: plpgsql, tablefunc, cube, plpython3u

软件包

  • RPM仓库:PIGSTY
  • RPM包名:pg4ml_$v
  • RPM版本:2.0
  • RPM依赖:无
  • DEB仓库:PIGSTY
  • DEB包名:postgresql-$v-pg4ml
  • DEB版本:2.0
  • DEB依赖:无

最新版本

系统 架构 PG17 PG16 PG15 PG14 PG13
el8 x86_64 pg4ml_17
PIGSTY 2.0
pg4ml_16
PIGSTY 2.0
pg4ml_15
PIGSTY 2.0
pg4ml_14
PIGSTY 2.0
pg4ml_13
PIGSTY 2.0
el8 aarch64 pg4ml_17
PIGSTY 2.0
pg4ml_16
PIGSTY 2.0
pg4ml_15
PIGSTY 2.0
pg4ml_14
PIGSTY 2.0
pg4ml_13
PIGSTY 2.0
el9 x86_64 pg4ml_17
PIGSTY 2.0
pg4ml_16
PIGSTY 2.0
pg4ml_15
PIGSTY 2.0
pg4ml_14
PIGSTY 2.0
pg4ml_13
PIGSTY 2.0
el9 aarch64 pg4ml_17
PIGSTY 2.0
pg4ml_16
PIGSTY 2.0
pg4ml_15
PIGSTY 2.0
pg4ml_14
PIGSTY 2.0
pg4ml_13
PIGSTY 2.0
d12 x86_64 postgresql-17-pg4ml
PIGSTY 2.0
postgresql-16-pg4ml
PIGSTY 2.0
postgresql-15-pg4ml
PIGSTY 2.0
postgresql-14-pg4ml
PIGSTY 2.0
postgresql-13-pg4ml
PIGSTY 2.0
d12 aarch64 postgresql-17-pg4ml
PIGSTY 2.0
postgresql-16-pg4ml
PIGSTY 2.0
postgresql-15-pg4ml
PIGSTY 2.0
postgresql-14-pg4ml
PIGSTY 2.0
postgresql-13-pg4ml
PIGSTY 2.0
u22 x86_64 postgresql-17-pg4ml
PIGSTY 2.0
postgresql-16-pg4ml
PIGSTY 2.0
postgresql-15-pg4ml
PIGSTY 2.0
postgresql-14-pg4ml
PIGSTY 2.0
postgresql-13-pg4ml
PIGSTY 2.0
u22 aarch64 postgresql-17-pg4ml
PIGSTY 2.0
postgresql-16-pg4ml
PIGSTY 2.0
postgresql-15-pg4ml
PIGSTY 2.0
postgresql-14-pg4ml
PIGSTY 2.0
postgresql-13-pg4ml
PIGSTY 2.0
u24 x86_64 postgresql-17-pg4ml
PIGSTY 2.0
postgresql-16-pg4ml
PIGSTY 2.0
postgresql-15-pg4ml
PIGSTY 2.0
postgresql-14-pg4ml
PIGSTY 2.0
postgresql-13-pg4ml
PIGSTY 2.0
u24 aarch64 postgresql-17-pg4ml
PIGSTY 2.0
postgresql-16-pg4ml
PIGSTY 2.0
postgresql-15-pg4ml
PIGSTY 2.0
postgresql-14-pg4ml
PIGSTY 2.0
postgresql-13-pg4ml
PIGSTY 2.0

扩展安装

使用 pig 命令行工具安装 pg4ml 扩展:

pig ext install pg4ml

使用 Pigsty剧本 安装 pg4ml 扩展:

./pgsql.yml -t pg_extension -e '{"pg_extensions": ["pg4ml"]}' # -l <集群名>

YUM仓库 手工安装 pg4ml RPM 包:

dnf install pg4ml_17;
dnf install pg4ml_16;
dnf install pg4ml_15;
dnf install pg4ml_14;
dnf install pg4ml_13;

APT仓库 手工安装 pg4ml DEB 包:

apt install postgresql-17-pg4ml;
apt install postgresql-16-pg4ml;
apt install postgresql-15-pg4ml;
apt install postgresql-14-pg4ml;
apt install postgresql-13-pg4ml;

使用以下 SQL 命令在已经安装此扩展插件的 PG 集群上 启用 pg4ml 扩展:

CREATE EXTENSION pg4ml CASCADE;



10 - pgml

PostgresML:用SQL运行机器学习算法并训练模型

扩展总览

PIGSTY 第三方扩展: pgml : PostgresML:用SQL运行机器学习算法并训练模型

基本信息

元数据

  • 默认版本: 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仓库 手工安装 pgml DEB 包:

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/