Skip to content
ClickHouse Docs

quantilesExact

Autogenerated from ClickHouse system tables

Introduced in: v1.1.0

Exactly computes multiple quantiles of a numeric data sequence at different levels simultaneously.

This function is equivalent to quantileExact but allows computing multiple quantile levels in a single pass, which is more efficient than calling individual quantile functions.

To get exact values, all the passed values are combined into an array, which is then partially sorted. Therefore, the function consumes O(n) memory, where n is the number of values passed.

Syntax

quantilesExact(level1, level2, ...)(expr)

Arguments

Returned value

Array of quantiles of the specified levels in the same order as the levels were specified. For numeric data types the output format matches the input format. Array((U)Int*) or Array(Int128) or Array(UInt128) or Array(Int256) or Array(UInt256) or Array(Float*) or Array(Decimal*) or Array(Date) or Array(DateTime) or Array(DateTime64)

Examples

Computing multiple exact quantiles

SELECT quantilesExact(0.25, 0.5, 0.75)(number) FROM numbers(10)
┌─quantilesExact(0.25, 0.5, 0.75)(number)─┐
│ [2,5,7]                                 │
└─────────────────────────────────────────┘