mean()
mean(sketch UddSketch) RETURNS DOUBLE PRECISION
mean(digest tdigest) RETURNS DOUBLE PRECISION
Get the exact average of all the values in the percentile estimate. (Percentiles returned are estimates, the average is exact). This is provided in order to save space when both a mean and a percentile estimate are required as part of continuous aggregates. You can simply compute a single percentile estimator and do not need to specify a separate avg
aggregate, just extract the mean from the percentile estimator.
Required arguments
Name | Type | Description |
---|---|---|
sketch / digest | UddSketch /tdigest | The sketch to extract the mean value from, usually from a percentile_agg() call. |
Returns
Column | Type | Description |
---|---|---|
mean | DOUBLE PRECISION | The average of the values in the percentile estimate. |
Sample usage
SELECT mean(percentile_agg(data))
FROM generate_series(0, 100) data;
mean
------
50
当前内容版权归 TimescaleDB 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 TimescaleDB .