> ## Documentation Index
> Fetch the complete documentation index at: https://clickhouse.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> 同时计算 Prometheus 直方图在不同级别上的多个分位数。

# quantilesPrometheusHistogram

<div id="quantilesPrometheusHistogram">
  ## quantilesPrometheusHistogram
</div>

引入版本：v25.10.0

使用线性插值在不同级别上一并计算 Prometheus 直方图的多个[分位数](https://en.wikipedia.org/wiki/Quantile)，同时考虑每个直方图 bucket 的累计值和上界。

此函数等同于 [`quantilePrometheusHistogram`](/docs/zh/reference/functions/aggregate-functions/quantilePrometheusHistogram)，但支持在单次遍历中计算多个分位数级别，因此比分别调用各个分位数函数更高效。

**语法**

```sql theme={null}
quantilesPrometheusHistogram(level1, level2, ...)(bucket_upper_bound, cumulative_bucket_value)
```

**参数**

* `level` — 分位数的级别。一个或多个介于 0 到 1 之间的常量浮点数。建议将 `level` 的值设在 `[0.01, 0.99]` 范围内。[`Float64`](/docs/zh/reference/data-types/float)

**Arguments**

* `bucket_upper_bound` — 直方图桶的上界。最高的桶的上界必须为 `+Inf`。[`Float*`](/docs/zh/reference/data-types/float)
* `cumulative_bucket_value` — 直方图桶的累计值。随着桶上界的增大，这些值必须单调递增。[`UInt*`](/docs/zh/reference/data-types/int-uint) 或 [`Float*`](/docs/zh/reference/data-types/float)

**返回值**

按指定级别的顺序返回对应的分位数数组。结果的浮点类型与 `bucket_upper_bound` 的类型一致。[`Array(Float32)`](/docs/zh/reference/data-types/array) 或 [`Array(Float64)`](/docs/zh/reference/data-types/array)

**示例**

**使用示例**

```sql title=Query theme={null}
SELECT quantilesPrometheusHistogram(0.25, 0.5, 0.75)(bucket_upper_bound, cumulative_bucket_value)
FROM VALUES('bucket_upper_bound Float64, cumulative_bucket_value UInt64', (0, 6), (0.5, 11), (1, 14), (inf, 19));
```

```response title=Response theme={null}
┌─quantilesPrometheusHistogram(0.25, 0.5, 0.75)(bucket_upper_bound, cumulative_bucket_value)─┐
│ [0,0.35,1]                                                                                 │
└────────────────────────────────────────────────────────────────────────────────────────────┘
```
