pg_analytics
由 DuckDB 驱动的数据分析引擎
概览
| 扩展包名 | 版本 | 分类 | 许可证 | 语言 |
|---|---|---|---|---|
pg_analytics | 0.3.7 | OLAP | PostgreSQL | Rust |
| ID | 扩展名 | Bin | Lib | Load | Create | Trust | Reloc | 模式 |
|---|---|---|---|---|---|---|---|---|
| 2420 | pg_analytics | 否 | 是 | 否 | 是 | 是 | 否 | paradedb |
| 相关扩展 | pg_duckdb pg_mooncake duckdb_fdw pg_parquet columnar citus_columnar orioledb citus |
|---|
archived, no longer maintained
版本
| 类型 | 仓库 | 版本 | PG 大版本 | 包名 | 依赖 |
|---|---|---|---|---|---|
| EXT | PIGSTY | 0.3.7 | 1817161514 | pg_analytics | - |
| RPM | PIGSTY | 0.3.7 | 1817161514 | pg_analytics_$v | - |
| DEB | PIGSTY | 0.3.7 | 1817161514 | postgresql-$v-pg-analytics | - |
| OS / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PIGSTY MISS | PIGSTY 0.3.7 el8.x86_64.pg17 : pg_analytics_17 pg_analytics_17-0.3.7-1PARADEDB.el8.x86_64.rpm
| PIGSTY 0.3.7 el8.x86_64.pg16 : pg_analytics_16 pg_analytics_16-0.3.7-1PARADEDB.el8.x86_64.rpm
| PIGSTY 0.3.7 el8.x86_64.pg15 : pg_analytics_15 pg_analytics_15-0.3.7-1PARADEDB.el8.x86_64.rpm
| PIGSTY 0.3.7 el8.x86_64.pg14 : pg_analytics_14 pg_analytics_14-0.3.7-1PARADEDB.el8.x86_64.rpm
|
| el8.aarch64 | PIGSTY MISS | PIGSTY 0.3.7 el8.aarch64.pg17 : pg_analytics_17 pg_analytics_17-0.3.7-1PARADEDB.el8.aarch64.rpm
| PIGSTY 0.3.7 el8.aarch64.pg16 : pg_analytics_16 pg_analytics_16-0.3.7-1PARADEDB.el8.aarch64.rpm
| PIGSTY 0.3.7 el8.aarch64.pg15 : pg_analytics_15 pg_analytics_15-0.3.7-1PARADEDB.el8.aarch64.rpm
| PIGSTY 0.3.7 el8.aarch64.pg14 : pg_analytics_14 pg_analytics_14-0.3.7-1PARADEDB.el8.aarch64.rpm
|
| el9.x86_64 | PIGSTY MISS | PIGSTY 0.3.7 el9.x86_64.pg17 : pg_analytics_17 pg_analytics_17-0.3.7-1PARADEDB.el9.x86_64.rpm
| PIGSTY 0.3.7 el9.x86_64.pg16 : pg_analytics_16 pg_analytics_16-0.3.7-1PARADEDB.el9.x86_64.rpm
| PIGSTY 0.3.7 el9.x86_64.pg15 : pg_analytics_15 pg_analytics_15-0.3.7-1PARADEDB.el9.x86_64.rpm
| PIGSTY 0.3.7 el9.x86_64.pg14 : pg_analytics_14 pg_analytics_14-0.3.7-1PARADEDB.el9.x86_64.rpm
|
| el9.aarch64 | PIGSTY MISS | PIGSTY 0.3.7 el9.aarch64.pg17 : pg_analytics_17 pg_analytics_17-0.3.7-1PARADEDB.el9.aarch64.rpm
| PIGSTY 0.3.7 el9.aarch64.pg16 : pg_analytics_16 pg_analytics_16-0.3.7-1PARADEDB.el9.aarch64.rpm
| PIGSTY 0.3.7 el9.aarch64.pg15 : pg_analytics_15 pg_analytics_15-0.3.7-1PARADEDB.el9.aarch64.rpm
| PIGSTY 0.3.7 el9.aarch64.pg14 : pg_analytics_14 pg_analytics_14-0.3.7-1PARADEDB.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 0.3.7 d12.x86_64.pg17 : postgresql-17-pg-analytics postgresql-17-pg-analytics_0.3.7_amd64.deb
| PIGSTY 0.3.7 d12.x86_64.pg16 : postgresql-16-pg-analytics postgresql-16-pg-analytics_0.3.7_amd64.deb
| PIGSTY 0.3.7 d12.x86_64.pg15 : postgresql-15-pg-analytics postgresql-15-pg-analytics_0.3.7_amd64.deb
| PIGSTY 0.3.7 d12.x86_64.pg14 : postgresql-14-pg-analytics postgresql-14-pg-analytics_0.3.7_amd64.deb
|
| d12.aarch64 | PIGSTY MISS | PIGSTY 0.3.7 d12.aarch64.pg17 : postgresql-17-pg-analytics postgresql-17-pg-analytics_0.3.7_arm64.deb
| PIGSTY 0.3.7 d12.aarch64.pg16 : postgresql-16-pg-analytics postgresql-16-pg-analytics_0.3.7_arm64.deb
| PIGSTY 0.3.7 d12.aarch64.pg15 : postgresql-15-pg-analytics postgresql-15-pg-analytics_0.3.7_arm64.deb
| PIGSTY 0.3.7 d12.aarch64.pg14 : postgresql-14-pg-analytics postgresql-14-pg-analytics_0.3.7_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 0.3.7 u22.x86_64.pg17 : postgresql-17-pg-analytics postgresql-17-pg-analytics_0.3.7_amd64.deb
| PIGSTY 0.3.7 u22.x86_64.pg16 : postgresql-16-pg-analytics postgresql-16-pg-analytics_0.3.7_amd64.deb
| PIGSTY 0.3.7 u22.x86_64.pg15 : postgresql-15-pg-analytics postgresql-15-pg-analytics_0.3.7_amd64.deb
| PIGSTY 0.3.7 u22.x86_64.pg14 : postgresql-14-pg-analytics postgresql-14-pg-analytics_0.3.7_amd64.deb
|
| u22.aarch64 | PIGSTY MISS | PIGSTY 0.3.7 u22.aarch64.pg17 : postgresql-17-pg-analytics postgresql-17-pg-analytics_0.3.7_arm64.deb
| PIGSTY 0.3.7 u22.aarch64.pg16 : postgresql-16-pg-analytics postgresql-16-pg-analytics_0.3.7_arm64.deb
| PIGSTY 0.3.7 u22.aarch64.pg15 : postgresql-15-pg-analytics postgresql-15-pg-analytics_0.3.7_arm64.deb
| PIGSTY 0.3.7 u22.aarch64.pg14 : postgresql-14-pg-analytics postgresql-14-pg-analytics_0.3.7_arm64.deb
|
| u24.x86_64 | PIGSTY MISS | PIGSTY 0.3.7 u24.x86_64.pg17 : postgresql-17-pg-analytics postgresql-17-pg-analytics_0.3.7_amd64.deb
| PIGSTY 0.3.7 u24.x86_64.pg16 : postgresql-16-pg-analytics postgresql-16-pg-analytics_0.3.7_amd64.deb
| PIGSTY 0.3.7 u24.x86_64.pg15 : postgresql-15-pg-analytics postgresql-15-pg-analytics_0.3.7_amd64.deb
| PIGSTY 0.3.7 u24.x86_64.pg14 : postgresql-14-pg-analytics postgresql-14-pg-analytics_0.3.7_amd64.deb
|
| u24.aarch64 | PIGSTY MISS | PIGSTY 0.3.7 u24.aarch64.pg17 : postgresql-17-pg-analytics postgresql-17-pg-analytics_0.3.7_arm64.deb
| PIGSTY 0.3.7 u24.aarch64.pg16 : postgresql-16-pg-analytics postgresql-16-pg-analytics_0.3.7_arm64.deb
| PIGSTY 0.3.7 u24.aarch64.pg15 : postgresql-15-pg-analytics postgresql-15-pg-analytics_0.3.7_arm64.deb
| PIGSTY 0.3.7 u24.aarch64.pg14 : postgresql-14-pg-analytics postgresql-14-pg-analytics_0.3.7_arm64.deb
|
安装
您可以直接安装 pg_analytics 扩展包的预置二进制包,首先确保 PGDG 和 PIGSTY 仓库已经添加并启用:
pig repo add pgsql -u # 添加仓库并更新缓存
使用 pig 或者是 apt/yum/dnf 安装扩展:
pig install pg_analytics; # 当前活跃 PG 版本安装
pig ext install -y pg_analytics -v 17 # PG 17
pig ext install -y pg_analytics -v 16 # PG 16
pig ext install -y pg_analytics -v 15 # PG 15
pig ext install -y pg_analytics -v 14 # PG 14
dnf install -y pg_analytics_17 # PG 17
dnf install -y pg_analytics_16 # PG 16
dnf install -y pg_analytics_15 # PG 15
dnf install -y pg_analytics_14 # PG 14
apt install -y postgresql-17-pg-analytics # PG 17
apt install -y postgresql-16-pg-analytics # PG 16
apt install -y postgresql-15-pg-analytics # PG 15
apt install -y postgresql-14-pg-analytics # PG 14
创建扩展:
CREATE EXTENSION pg_analytics;
此扩展已于 2025 年 3 月归档,不再维护。ParadeDB 的分析功能已整合到 pg_search 中。建议使用 pg_duckdb 或 pg_mooncake 作为数据湖分析的替代方案。
用法
https://github.com/paradedb/pg_analytics
示例:从 S3 读取 Parquet 文件:
CREATE EXTENSION pg_analytics;
CREATE FOREIGN DATA WRAPPER parquet_wrapper HANDLER parquet_fdw_handler VALIDATOR parquet_fdw_validator;
-- 提供 S3 凭证
CREATE SERVER parquet_server FOREIGN DATA WRAPPER parquet_wrapper;
-- 创建外部表并自动生成表结构
CREATE FOREIGN TABLE trips ()
SERVER parquet_server
OPTIONS (files 's3://paradedb-benchmarks/yellow_tripdata_2024-01.parquet');
-- 完成!现在可以像查询普通 PostgreSQL 表一样查询远程 Parquet 文件
SELECT COUNT(*) FROM trips;
count
---------
2964624
(1 row)
该外部数据包装器目前仅支持只读操作。
Iceberg 支持
CREATE EXTENSION pg_analytics;
CREATE FOREIGN DATA WRAPPER iceberg_wrapper
HANDLER iceberg_fdw_handler
VALIDATOR iceberg_fdw_validator;
CREATE SERVER iceberg_server
FOREIGN DATA WRAPPER iceberg_wrapper;
-- 请将示例中的占位结构替换为实际的表结构定义
CREATE FOREIGN TABLE iceberg_table (x INT)
SERVER iceberg_server
OPTIONS (files 's3://bucket/iceberg_folder');
-- 完成!现在可以查询 Iceberg 表了
SELECT COUNT(*) FROM iceberg_table;