Files
doris/docs/en/sql-reference/sql-functions/aggregate-functions/percentile.md
Hao Tan 66a7a4b294 [Feature] Support exact percentile aggregate function (#6410)
Support to calculate the exact percentile value array of numeric column `col` at the given percentage(s).
2021-08-18 15:56:06 +08:00

1.6 KiB

title, language
title language
PERCENTILE en

PERCENTILE

Description

Syntax

PERCENTILE(expr, DOUBLE p)

Calculate the exact percentile, suitable for small data volumes. Sort the specified column in descending order first, and then take the exact p-th percentile. The value of p is between 0 and 1

Parameter Description: expr: required. The value is an integer (bigint at most). p: The exact percentile is required. The value is [0.0,1.0]

example

MySQL > select `table`, percentile(cost_time,0.99) from log_statis group by `table`;
+---------------------+---------------------------+
| table    |         percentile(`cost_time`, 0.99)|
+----------+--------------------------------------+
| test     |                                54.22 |
+----------+--------------------------------------+

## keyword
PERCENTILE