ddsketch
实现DDSketch数据结构,实现在线的Quantile聚合
ddsketch · 实现DDSketch数据结构,实现在线的Quantile聚合
概览
| ID | 扩展 | 软件包 | 版本 | 类别 | 许可证 | 编程语言 |
|---|---|---|---|---|---|---|
| 4650 | ddsketch | ddsketch | 1.0.1 | FUNC | PostgreSQL | C |
| 属性 | 可执行文件 | 动态库 | 需要预加载 | 需要建扩展 | 可迁移 | 可信 |
|---|---|---|---|---|---|---|
| --s-d-r | 否 | 是 | 否 | 是 | 是 | 否 |
| 关联 | |
|---|---|
| 相关扩展 | tdigest count_distinct topn omnisketch datasketches hll quantile lower_quantile weighted_statistics |
软件包
| Linux / PG | PG19 | PG18 | PG17 | PG16 | PG15 |
|---|---|---|---|---|---|
| el8.x86_64 | N/A | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 |
| el8.aarch64 | N/A | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 |
| el9.x86_64 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 |
| el9.aarch64 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 |
| el10.x86_64 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 |
| el10.aarch64 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 |
| d12.x86_64 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 |
| d12.aarch64 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 |
| d13.x86_64 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 |
| d13.aarch64 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 |
| u22.x86_64 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 |
| u22.aarch64 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 |
| u24.x86_64 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 |
| u24.aarch64 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 |
| u26.x86_64 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 |
| u26.aarch64 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 | PIGSTY 1.0.1 |
源码
安装
在数据库中创建扩展。
用法
实现了 DDSketch,一种完全可合并的分位数草图,提供相对误差保证。比 percentile_cont 快得多,并支持并行处理。
直接聚合函数
| 函数 | 描述 |
|---|---|
ddsketch_percentile(value, alpha, nbuckets, quantile) | 估计单个百分位数 |
ddsketch_percentile(value, alpha, nbuckets, quantiles[]) | 估计多个百分位数 |
ddsketch_percentile_of(value, alpha, nbuckets, value) | 估计某个值的百分位排名 |
ddsketch_percentile_of(value, alpha, nbuckets, values[]) | 估计多个值的百分位排名 |
预聚合函数
| 函数 | 描述 |
|---|---|
ddsketch(value, alpha, nbuckets) | 从值构建 ddsketch |
ddsketch_percentile(sketch, quantile) | 从预构建的草图估计百分位数 |
ddsketch_percentile(sketch, quantiles[]) | 从预构建的草图估计多个百分位数 |
工具函数
| 函数 | 描述 |
|---|---|
ddsketch_count(sketch) | 返回草图中的项目数量 |
ddsketch_sum(sketch, low, high) | 指定值范围内的截断求和 |
ddsketch_avg(sketch, low, high) | 指定值范围内的截断平均值 |
参数
alpha– 控制精度和草图大小(越小越精确,但体积越大)nbuckets– 最大桶数(每个 8 字节)