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

# approx_percentile_array()

> Estimate the values for an array of given percentiles from a `uddsketch`

<Icon icon="tag" iconType="duotone" /> Since [1.16.0][toolkit-1.16.0]

Estimate the approximate values of an array of percentiles from a `uddsketch` aggregate.

## Samples

Estimate the value at the 90th, 50th, and 20th percentiles, given a sample containing the numbers from 0 to 100.

```sql theme={"dark"}
SELECT
  approx_percentile_array(array[0.9,0.5,0.2], uddsketch(100,0.005,data))
FROM generate_series(0, 100) data;
```

```sql theme={"dark"}
approx_percentile_array
-------------------
 {90.0,50.0,20.0}
```

## Arguments

The syntax is:

```sql theme={"dark"}
approx_percentile_array(
  percentiles DOUBLE PRECISION[],
  uddsketch  UddSketch
) RETURNS DOUBLE PRECISION[]
```

| Name        | Type                | Default | Required | Description                                                            |
| ----------- | ------------------- | ------- | -------- | ---------------------------------------------------------------------- |
| percentiles | DOUBLE PRECISION\[] | -       | ✔        | array of percentiles to compute. Must be within the range `[0.0, 1.0]` |
| sketch      | UddSketch           | -       | ✔        | the `uddsketch` aggregate                                              |

## Returns

| Column                    | Type                | Description                                        |
| ------------------------- | ------------------- | -------------------------------------------------- |
| approx\_percentile\_array | DOUBLE PRECISION\[] | The estimated values at the requested percentiles. |

[toolkit-1.16.0]: https://github.com/timescale/timescaledb-toolkit/releases/tag/1.16.0
