> ## 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.

# mean()

> Calculate the exact mean from values in a `uddsketch`

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

Calculate the exact mean of the values in a `uddsketch`. Unlike percentile calculations, the mean calculation is exact.
This accessor allows you to calculate the mean alongside percentiles, without needing to create two separate aggregates
from the same raw data.

## Samples

Calculate the mean of the integers from 0 to 100.

```sql theme={"dark"}
SELECT mean(uddsketch(100, 0.001, data::double precision))
FROM generate_series(0, 100) data;
```

```
mean
------
50
```

## Arguments

The syntax is:

```sql theme={"dark"}
mean(
  sketch UddSketch
) RETURNS DOUBLE PRECISION
```

| Name   | Type      | Default | Required | Description                              |
| ------ | --------- | ------- | -------- | ---------------------------------------- |
| sketch | UddSketch | -       | ✔        | The `uddsketch` to extract the mean from |

## Returns

| Column | Type             | Description                                |
| ------ | ---------------- | ------------------------------------------ |
| mean   | DOUBLE PRECISION | The mean of the values in the `uddsketch`. |

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