> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-postgresql-tls-support.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> Computes multiple quantiles of a numeric sequence with determined precision at different levels simultaneously.

# quantilesTiming

<h2 id="quantilesTiming">
  quantilesTiming
</h2>

Introduced in: v1.1.0

Computes multiple [quantiles](https://en.wikipedia.org/wiki/Quantile) of a numeric data sequence at different levels simultaneously with determined precision.

This function is equivalent to [`quantileTiming`](/reference/functions/aggregate-functions/quantileTiming) but allows computing multiple quantile levels in a single pass, which is more efficient than calling individual quantile functions.

The result is deterministic (it does not depend on the query processing order). The function is optimized for working with sequences which describe distributions like loading web pages times or backend response times.

**Accuracy**

The calculation is accurate if:

* Total number of values does not exceed 5670.
* Total number of values exceeds 5670, but the page loading time is less than 1024ms.

Otherwise, the result of the calculation is rounded to the nearest multiple of 16 ms.

<Note>
  For calculating page loading time quantiles, this function is more effective and accurate than [`quantiles`](/reference/functions/aggregate-functions/quantiles).
</Note>

**Syntax**

```sql theme={null}
quantilesTiming(level1, level2, ...)(expr)
```

**Parameters**

* `level` — Levels of quantiles. One or more constant floating-point numbers from 0 to 1. We recommend using `level` values in the range of `[0.01, 0.99]`. [`Float*`](/reference/data-types/float)

**Arguments**

* `expr` — Expression over the column values resulting in numeric data types, `Date` or `DateTime`. If negative values are passed to the function, the behavior is undefined. If the value is greater than 30,000 (a page loading time of more than 30 seconds), it is assumed to be 30,000. [`(U)Int*`](/reference/data-types/int-uint) or [`Float*`](/reference/data-types/float) or [`Date`](/reference/data-types/date) or [`DateTime`](/reference/data-types/datetime)

**Returned value**

Array of quantiles of the specified levels in the same order as the levels were specified. [`Array(Float32)`](/reference/data-types/array)

**Examples**

**Computing multiple timing quantiles**

```sql title=Query theme={null}
CREATE TABLE t (response_time UInt32) ENGINE = Memory;
INSERT INTO t VALUES (72), (112), (126), (145), (104), (242), (313), (168), (108);

SELECT quantilesTiming(0.25, 0.5, 0.75)(response_time) FROM t;
```

```response title=Response theme={null}
┌─quantilesTiming(0.25, 0.5, 0.75)(response_time)─┐
│ [108,126,168]                                   │
└─────────────────────────────────────────────────┘
```
