count_distinct
COUNT(DISTINCT …) 聚合的替代方案
概述
4630 | count_distinct | count_distinct | 3.0.2 | FUNC | BSD 2-Clause | C |
属性
是 | 否 | 是 | 否 | 是 | 是 | 否 | - |
软件包
EL | PIGSTY | count_distinct_$v* | 3.0.2 | - | 17 16 15 14 13 |
Debian | PIGSTY | postgresql-$v-count-distinct | 3.0.2 | - | 17 16 15 14 13 |
注释
no pg14,13,12 on el8/9 pgdg
可用性
PG17 | PG16 | PG15 | PG14 | PG13 | |
---|---|---|---|---|---|
el8.x86_64 | 3.0.2 | 3.0.2 | 3.0.2 | 3.0.2 | 3.0.2 |
el8.aarch64 | 3.0.2 | 3.0.2 | 3.0.2 | 3.0.2 | 3.0.2 |
el9.x86_64 | 3.0.2 | 3.0.2 | 3.0.2 | 3.0.2 | 3.0.2 |
el9.aarch64 | 3.0.2 | 3.0.2 | 3.0.2 | 3.0.2 | 3.0.2 |
d12.x86_64 | 3.0.2 | 3.0.2 | 3.0.2 | 3.0.2 | 3.0.2 |
d12.aarch64 | 3.0.2 | 3.0.2 | 3.0.2 | 3.0.2 | 3.0.2 |
u22.x86_64 | 3.0.2 | 3.0.2 | 3.0.2 | 3.0.2 | 3.0.2 |
u22.aarch64 | 3.0.2 | 3.0.2 | 3.0.2 | 3.0.2 | 3.0.2 |
u24.x86_64 | 3.0.2 | 3.0.2 | 3.0.2 | 3.0.2 | 3.0.2 |
u24.aarch64 | 3.0.2 | 3.0.2 | 3.0.2 | 3.0.2 | 3.0.2 |
CONTRIB
PGDG
PIGSTY
下载
要添加所需的 PGDG / PIGSTY 上游仓库,请使用:
pig repo add pgdg -u # 添加 PGDG 仓库并更新缓存(保留现有仓库)
pig repo add pigsty -u # 添加 PIGSTY 仓库并更新缓存(保留现有仓库)
pig repo add pgsql -u # 添加 PGDG + Pigsty 仓库并更新缓存(保留现有仓库)
pig repo set all -u # 设置仓库为 all = NODE + PGSQL + INFRA (移除现有仓库)
./node.yml -t node_repo -e node_repo_modules=node,pgsql # -l <集群>
或直接下载最新包:
安装
使用以下命令安装此扩展:
pig ext install count_distinct; # 按扩展名安装,适用于当前活动的 PG 版本
pig ext install count_distinct -v 17; # 为 PG 17 安装
pig ext install count_distinct -v 16; # 为 PG 16 安装
pig ext install count_distinct -v 15; # 为 PG 15 安装
pig ext install count_distinct -v 14; # 为 PG 14 安装
pig ext install count_distinct -v 13; # 为 PG 13 安装
dnf install count_distinct_17*;
dnf install count_distinct_16*;
dnf install count_distinct_15*;
dnf install count_distinct_14*;
dnf install count_distinct_13*;
apt install postgresql-17-count-distinct;
apt install postgresql-16-count-distinct;
apt install postgresql-15-count-distinct;
apt install postgresql-14-count-distinct;
apt install postgresql-13-count-distinct;
./pgsql.yml -t pg_ext -e '{"pg_extensions": ["count_distinct"]}' # -l <集群>
使用以下命令创建此扩展:
CREATE EXTENSION count_distinct;