跳转到主要内容

aggs_for_arrays

计算数组聚合统计值的函数包

aggs_for_arrays · 计算数组聚合统计值的函数包

概览

ID扩展软件包版本类别许可证编程语言
4760aggs_for_arraysaggs_for_arrays1.3.3FUNCMITC
属性可执行文件动态库需要预加载需要建扩展可迁移可信
--s-d-r否是否是是否

软件包

类型仓库版本兼容的 PostgreSQL 大版本包名模式依赖
EXTPIGSTY1.3.319 18 17 16 15aggs_for_arrays-
RPMPIGSTY1.3.319 18 17 16 15aggs_for_arrays_$v-
DEBPIGSTY1.3.319 18 17 16 15postgresql-$v-aggs-for-arrays-
Linux / PGPG19PG18PG17PG16PG15
el8.x86_64N/APIGSTY 1.3.3PIGSTY 1.3.3PIGSTY 1.3.3PIGSTY 1.3.3
el8.aarch64N/APIGSTY 1.3.3PIGSTY 1.3.3PIGSTY 1.3.3PIGSTY 1.3.3
el9.x86_64PIGSTY 1.3.3PIGSTY 1.3.3PIGSTY 1.3.3PIGSTY 1.3.3PIGSTY 1.3.3
el9.aarch64PIGSTY 1.3.3PIGSTY 1.3.3PIGSTY 1.3.3PIGSTY 1.3.3PIGSTY 1.3.3
el10.x86_64PIGSTY 1.3.3PIGSTY 1.3.3PIGSTY 1.3.3PIGSTY 1.3.3PIGSTY 1.3.3
el10.aarch64PIGSTY 1.3.3PIGSTY 1.3.3PIGSTY 1.3.3PIGSTY 1.3.3PIGSTY 1.3.3
d12.x86_64PIGSTY 1.3.3PIGSTY 1.3.3PIGSTY 1.3.3PIGSTY 1.3.3PIGSTY 1.3.3
d12.aarch64PIGSTY 1.3.3PIGSTY 1.3.3PIGSTY 1.3.3PIGSTY 1.3.3PIGSTY 1.3.3
d13.x86_64PIGSTY 1.3.3PIGSTY 1.3.3PIGSTY 1.3.3PIGSTY 1.3.3PIGSTY 1.3.3
d13.aarch64PIGSTY 1.3.3PIGSTY 1.3.3PIGSTY 1.3.3PIGSTY 1.3.3PIGSTY 1.3.3
u22.x86_64PIGSTY 1.3.3PIGSTY 1.3.3PIGSTY 1.3.3PIGSTY 1.3.3PIGSTY 1.3.3
u22.aarch64PIGSTY 1.3.3PIGSTY 1.3.3PIGSTY 1.3.3PIGSTY 1.3.3PIGSTY 1.3.3
u24.x86_64PIGSTY 1.3.3PIGSTY 1.3.3PIGSTY 1.3.3PIGSTY 1.3.3PIGSTY 1.3.3
u24.aarch64PIGSTY 1.3.3PIGSTY 1.3.3PIGSTY 1.3.3PIGSTY 1.3.3PIGSTY 1.3.3
u26.x86_64PIGSTY 1.3.3PIGSTY 1.3.3PIGSTY 1.3.3PIGSTY 1.3.3PIGSTY 1.3.3
u26.aarch64PIGSTY 1.3.3PIGSTY 1.3.3PIGSTY 1.3.3PIGSTY 1.3.3PIGSTY 1.3.3
软件包版本平台仓库大小下载
aggs_for_arrays_191.3.3el9.x86_64pigsty52.4 KiBaggs_for_arrays_19-1.3.3-1PGSTY.el9.x86_64.rpm
aggs_for_arrays_191.3.3el9.aarch64pigsty56.9 KiBaggs_for_arrays_19-1.3.3-1PGSTY.el9.aarch64.rpm
aggs_for_arrays_191.3.3el10.x86_64pigsty53.6 KiBaggs_for_arrays_19-1.3.3-1PGSTY.el10.x86_64.rpm
aggs_for_arrays_191.3.3el10.aarch64pigsty59.2 KiBaggs_for_arrays_19-1.3.3-1PGSTY.el10.aarch64.rpm
postgresql-19-aggs-for-arrays1.3.3d12.x86_64pigsty42.4 KiBpostgresql-19-aggs-for-arrays_1.3.3-1PGSTY~bookworm_amd64.deb
postgresql-19-aggs-for-arrays1.3.3d12.aarch64pigsty46.9 KiBpostgresql-19-aggs-for-arrays_1.3.3-1PGSTY~bookworm_arm64.deb
postgresql-19-aggs-for-arrays1.3.3d13.x86_64pigsty43.0 KiBpostgresql-19-aggs-for-arrays_1.3.3-1PGSTY~trixie_amd64.deb
postgresql-19-aggs-for-arrays1.3.3d13.aarch64pigsty47.8 KiBpostgresql-19-aggs-for-arrays_1.3.3-1PGSTY~trixie_arm64.deb
postgresql-19-aggs-for-arrays1.3.3u22.x86_64pigsty44.4 KiBpostgresql-19-aggs-for-arrays_1.3.3-1PGSTY~jammy_amd64.deb
postgresql-19-aggs-for-arrays1.3.3u22.aarch64pigsty48.5 KiBpostgresql-19-aggs-for-arrays_1.3.3-1PGSTY~jammy_arm64.deb
postgresql-19-aggs-for-arrays1.3.3u24.x86_64pigsty43.9 KiBpostgresql-19-aggs-for-arrays_1.3.3-1PGSTY~noble_amd64.deb
postgresql-19-aggs-for-arrays1.3.3u24.aarch64pigsty49.8 KiBpostgresql-19-aggs-for-arrays_1.3.3-1PGSTY~noble_arm64.deb
postgresql-19-aggs-for-arrays1.3.3u26.x86_64pigsty44.4 KiBpostgresql-19-aggs-for-arrays_1.3.3-1PGSTY~resolute_amd64.deb
postgresql-19-aggs-for-arrays1.3.3u26.aarch64pigsty49.9 KiBpostgresql-19-aggs-for-arrays_1.3.3-1PGSTY~resolute_arm64.deb
软件包版本平台仓库大小下载
aggs_for_arrays_181.3.3el8.x86_64pigsty52.3 KiBaggs_for_arrays_18-1.3.3-1PGSTY.el8.x86_64.rpm
aggs_for_arrays_181.3.3el8.aarch64pigsty55.6 KiBaggs_for_arrays_18-1.3.3-1PGSTY.el8.aarch64.rpm
aggs_for_arrays_181.3.3el9.x86_64pigsty52.4 KiBaggs_for_arrays_18-1.3.3-1PGSTY.el9.x86_64.rpm
aggs_for_arrays_181.3.3el9.aarch64pigsty56.9 KiBaggs_for_arrays_18-1.3.3-1PGSTY.el9.aarch64.rpm
aggs_for_arrays_181.3.3el10.x86_64pigsty53.6 KiBaggs_for_arrays_18-1.3.3-1PGSTY.el10.x86_64.rpm
aggs_for_arrays_181.3.3el10.aarch64pigsty59.2 KiBaggs_for_arrays_18-1.3.3-1PGSTY.el10.aarch64.rpm
postgresql-18-aggs-for-arrays1.3.3d12.x86_64pigsty42.4 KiBpostgresql-18-aggs-for-arrays_1.3.3-1PGSTY~bookworm_amd64.deb
postgresql-18-aggs-for-arrays1.3.3d12.aarch64pigsty46.9 KiBpostgresql-18-aggs-for-arrays_1.3.3-1PGSTY~bookworm_arm64.deb
postgresql-18-aggs-for-arrays1.3.3d13.x86_64pigsty43.0 KiBpostgresql-18-aggs-for-arrays_1.3.3-1PGSTY~trixie_amd64.deb
postgresql-18-aggs-for-arrays1.3.3d13.aarch64pigsty47.8 KiBpostgresql-18-aggs-for-arrays_1.3.3-1PGSTY~trixie_arm64.deb
postgresql-18-aggs-for-arrays1.3.3u22.x86_64pigsty44.4 KiBpostgresql-18-aggs-for-arrays_1.3.3-1PGSTY~jammy_amd64.deb
postgresql-18-aggs-for-arrays1.3.3u22.aarch64pigsty48.5 KiBpostgresql-18-aggs-for-arrays_1.3.3-1PGSTY~jammy_arm64.deb
postgresql-18-aggs-for-arrays1.3.3u24.x86_64pigsty43.8 KiBpostgresql-18-aggs-for-arrays_1.3.3-1PGSTY~noble_amd64.deb
postgresql-18-aggs-for-arrays1.3.3u24.aarch64pigsty49.8 KiBpostgresql-18-aggs-for-arrays_1.3.3-1PGSTY~noble_arm64.deb
postgresql-18-aggs-for-arrays1.3.3u26.x86_64pigsty44.4 KiBpostgresql-18-aggs-for-arrays_1.3.3-1PGSTY~resolute_amd64.deb
postgresql-18-aggs-for-arrays1.3.3u26.aarch64pigsty49.9 KiBpostgresql-18-aggs-for-arrays_1.3.3-1PGSTY~resolute_arm64.deb
软件包版本平台仓库大小下载
aggs_for_arrays_171.3.3el8.x86_64pigsty52.3 KiBaggs_for_arrays_17-1.3.3-1PGSTY.el8.x86_64.rpm
aggs_for_arrays_171.3.3el8.aarch64pigsty55.3 KiBaggs_for_arrays_17-1.3.3-1PGSTY.el8.aarch64.rpm
aggs_for_arrays_171.3.3el9.x86_64pigsty52.2 KiBaggs_for_arrays_17-1.3.3-1PGSTY.el9.x86_64.rpm
aggs_for_arrays_171.3.3el9.aarch64pigsty56.7 KiBaggs_for_arrays_17-1.3.3-1PGSTY.el9.aarch64.rpm
aggs_for_arrays_171.3.3el10.x86_64pigsty53.7 KiBaggs_for_arrays_17-1.3.3-1PGSTY.el10.x86_64.rpm
aggs_for_arrays_171.3.3el10.aarch64pigsty59.3 KiBaggs_for_arrays_17-1.3.3-1PGSTY.el10.aarch64.rpm
postgresql-17-aggs-for-arrays1.3.3d12.x86_64pigsty42.5 KiBpostgresql-17-aggs-for-arrays_1.3.3-1PGSTY~bookworm_amd64.deb
postgresql-17-aggs-for-arrays1.3.3d12.aarch64pigsty47.1 KiBpostgresql-17-aggs-for-arrays_1.3.3-1PGSTY~bookworm_arm64.deb
postgresql-17-aggs-for-arrays1.3.3d13.x86_64pigsty43.0 KiBpostgresql-17-aggs-for-arrays_1.3.3-1PGSTY~trixie_amd64.deb
postgresql-17-aggs-for-arrays1.3.3d13.aarch64pigsty48.0 KiBpostgresql-17-aggs-for-arrays_1.3.3-1PGSTY~trixie_arm64.deb
postgresql-17-aggs-for-arrays1.3.3u22.x86_64pigsty45.7 KiBpostgresql-17-aggs-for-arrays_1.3.3-1PGSTY~jammy_amd64.deb
postgresql-17-aggs-for-arrays1.3.3u22.aarch64pigsty49.9 KiBpostgresql-17-aggs-for-arrays_1.3.3-1PGSTY~jammy_arm64.deb
postgresql-17-aggs-for-arrays1.3.3u24.x86_64pigsty43.8 KiBpostgresql-17-aggs-for-arrays_1.3.3-1PGSTY~noble_amd64.deb
postgresql-17-aggs-for-arrays1.3.3u24.aarch64pigsty49.8 KiBpostgresql-17-aggs-for-arrays_1.3.3-1PGSTY~noble_arm64.deb
postgresql-17-aggs-for-arrays1.3.3u26.x86_64pigsty44.5 KiBpostgresql-17-aggs-for-arrays_1.3.3-1PGSTY~resolute_amd64.deb
postgresql-17-aggs-for-arrays1.3.3u26.aarch64pigsty50.0 KiBpostgresql-17-aggs-for-arrays_1.3.3-1PGSTY~resolute_arm64.deb
软件包版本平台仓库大小下载
aggs_for_arrays_161.3.3el8.x86_64pigsty52.3 KiBaggs_for_arrays_16-1.3.3-1PGSTY.el8.x86_64.rpm
aggs_for_arrays_161.3.3el8.aarch64pigsty55.3 KiBaggs_for_arrays_16-1.3.3-1PGSTY.el8.aarch64.rpm
aggs_for_arrays_161.3.3el9.x86_64pigsty52.2 KiBaggs_for_arrays_16-1.3.3-1PGSTY.el9.x86_64.rpm
aggs_for_arrays_161.3.3el9.aarch64pigsty56.7 KiBaggs_for_arrays_16-1.3.3-1PGSTY.el9.aarch64.rpm
aggs_for_arrays_161.3.3el10.x86_64pigsty53.7 KiBaggs_for_arrays_16-1.3.3-1PGSTY.el10.x86_64.rpm
aggs_for_arrays_161.3.3el10.aarch64pigsty59.3 KiBaggs_for_arrays_16-1.3.3-1PGSTY.el10.aarch64.rpm
postgresql-16-aggs-for-arrays1.3.3d12.x86_64pigsty42.5 KiBpostgresql-16-aggs-for-arrays_1.3.3-1PGSTY~bookworm_amd64.deb
postgresql-16-aggs-for-arrays1.3.3d12.aarch64pigsty47.0 KiBpostgresql-16-aggs-for-arrays_1.3.3-1PGSTY~bookworm_arm64.deb
postgresql-16-aggs-for-arrays1.3.3d13.x86_64pigsty43.0 KiBpostgresql-16-aggs-for-arrays_1.3.3-1PGSTY~trixie_amd64.deb
postgresql-16-aggs-for-arrays1.3.3d13.aarch64pigsty47.9 KiBpostgresql-16-aggs-for-arrays_1.3.3-1PGSTY~trixie_arm64.deb
postgresql-16-aggs-for-arrays1.3.3u22.x86_64pigsty45.7 KiBpostgresql-16-aggs-for-arrays_1.3.3-1PGSTY~jammy_amd64.deb
postgresql-16-aggs-for-arrays1.3.3u22.aarch64pigsty49.9 KiBpostgresql-16-aggs-for-arrays_1.3.3-1PGSTY~jammy_arm64.deb
postgresql-16-aggs-for-arrays1.3.3u24.x86_64pigsty43.7 KiBpostgresql-16-aggs-for-arrays_1.3.3-1PGSTY~noble_amd64.deb
postgresql-16-aggs-for-arrays1.3.3u24.aarch64pigsty49.8 KiBpostgresql-16-aggs-for-arrays_1.3.3-1PGSTY~noble_arm64.deb
postgresql-16-aggs-for-arrays1.3.3u26.x86_64pigsty44.5 KiBpostgresql-16-aggs-for-arrays_1.3.3-1PGSTY~resolute_amd64.deb
postgresql-16-aggs-for-arrays1.3.3u26.aarch64pigsty50.0 KiBpostgresql-16-aggs-for-arrays_1.3.3-1PGSTY~resolute_arm64.deb
软件包版本平台仓库大小下载
aggs_for_arrays_151.3.3el8.x86_64pigsty52.7 KiBaggs_for_arrays_15-1.3.3-1PGSTY.el8.x86_64.rpm
aggs_for_arrays_151.3.3el8.aarch64pigsty55.7 KiBaggs_for_arrays_15-1.3.3-1PGSTY.el8.aarch64.rpm
aggs_for_arrays_151.3.3el9.x86_64pigsty52.6 KiBaggs_for_arrays_15-1.3.3-1PGSTY.el9.x86_64.rpm
aggs_for_arrays_151.3.3el9.aarch64pigsty57.1 KiBaggs_for_arrays_15-1.3.3-1PGSTY.el9.aarch64.rpm
aggs_for_arrays_151.3.3el10.x86_64pigsty54.0 KiBaggs_for_arrays_15-1.3.3-1PGSTY.el10.x86_64.rpm
aggs_for_arrays_151.3.3el10.aarch64pigsty59.7 KiBaggs_for_arrays_15-1.3.3-1PGSTY.el10.aarch64.rpm
postgresql-15-aggs-for-arrays1.3.3d12.x86_64pigsty42.6 KiBpostgresql-15-aggs-for-arrays_1.3.3-1PGSTY~bookworm_amd64.deb
postgresql-15-aggs-for-arrays1.3.3d12.aarch64pigsty47.2 KiBpostgresql-15-aggs-for-arrays_1.3.3-1PGSTY~bookworm_arm64.deb
postgresql-15-aggs-for-arrays1.3.3d13.x86_64pigsty43.2 KiBpostgresql-15-aggs-for-arrays_1.3.3-1PGSTY~trixie_amd64.deb
postgresql-15-aggs-for-arrays1.3.3d13.aarch64pigsty48.1 KiBpostgresql-15-aggs-for-arrays_1.3.3-1PGSTY~trixie_arm64.deb
postgresql-15-aggs-for-arrays1.3.3u22.x86_64pigsty45.8 KiBpostgresql-15-aggs-for-arrays_1.3.3-1PGSTY~jammy_amd64.deb
postgresql-15-aggs-for-arrays1.3.3u22.aarch64pigsty50.2 KiBpostgresql-15-aggs-for-arrays_1.3.3-1PGSTY~jammy_arm64.deb
postgresql-15-aggs-for-arrays1.3.3u24.x86_64pigsty43.9 KiBpostgresql-15-aggs-for-arrays_1.3.3-1PGSTY~noble_amd64.deb
postgresql-15-aggs-for-arrays1.3.3u24.aarch64pigsty50.2 KiBpostgresql-15-aggs-for-arrays_1.3.3-1PGSTY~noble_arm64.deb
postgresql-15-aggs-for-arrays1.3.3u26.x86_64pigsty44.8 KiBpostgresql-15-aggs-for-arrays_1.3.3-1PGSTY~resolute_amd64.deb
postgresql-15-aggs-for-arrays1.3.3u26.aarch64pigsty50.3 KiBpostgresql-15-aggs-for-arrays_1.3.3-1PGSTY~resolute_arm64.deb

源码

pig build pkg aggs_for_arrays;		# build rpm/deb

安装

启用 PGDG 和 PIGSTY 仓库并更新缓存。

pig repo add pgsql -u   # add both repo and update cache

使用 pig 安装扩展。

pig install aggs_for_arrays;		# install by package name

pig install aggs_for_arrays -v 19;   # install for PG 19
pig install aggs_for_arrays -v 18;   # install for PG 18
pig install aggs_for_arrays -v 17;   # install for PG 17
pig install aggs_for_arrays -v 16;   # install for PG 16
pig install aggs_for_arrays -v 15;   # install for PG 15

在数据库中创建扩展。

CREATE EXTENSION aggs_for_arrays;

用法

aggs_for_arrays: 单数组的类聚合函数(逐列模式)

提供对单个数组输入计算统计量的函数。支持 SMALLINT、INTEGER、BIGINT、REAL 和 DOUBLE PRECISION 类型。

CREATE EXTENSION aggs_for_arrays;

函数

函数说明
array_to_hist(values T[], start T, width T, count INT)计算直方图分桶计数
array_to_hist_2d(x[], y[], ...)二维直方图
array_to_mean(values T[])数组元素的均值
array_to_median(values T[])中位数(输入无需排序)
sorted_array_to_median(values T[])中位数(输入已排序)
array_to_mode(values T[])数组元素的众数
sorted_array_to_mode(values T[])众数(输入已排序)
array_to_percentile(values T[], pct FLOAT)百分位数(0 到 1)
sorted_array_to_percentile(values T[], pct FLOAT)百分位数(输入已排序)
array_to_percentiles(values T[], pcts FLOAT[])多个百分位数
sorted_array_to_percentiles(values T[], pcts FLOAT[])多个百分位数(输入已排序)
array_to_max(values T[])最大元素
array_to_min(values T[])最小元素
array_to_min_max(values T[]){min, max} 元组
array_to_skewness(values T[])偏度
array_to_kurtosis(values T[])峰度

示例

-- 10 个分桶的直方图,起始值 0,桶宽 10
SELECT array_to_hist(ARRAY[5,15,25,35,45], 0, 10, 5);
-- {1,1,1,1,1}

-- 均值和中位数
SELECT array_to_mean(ARRAY[1,2,3,4,5]);   -- 3.0
SELECT array_to_median(ARRAY[1,2,3,4,5]); -- 3.0

-- 百分位数
SELECT array_to_percentile(ARRAY[1,2,3,4,5,6,7,8,9,10], 0.95);

-- 一次计算多个百分位数
SELECT array_to_percentiles(ARRAY[1,2,3,4,5], ARRAY[0.25, 0.5, 0.75]);

表格阅读器