---
title: rollup() | Tiger Data Docs
description: Combine multiple frequency aggregates
---

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

Combine multiple aggregates created with `freq_agg` or `mcv_agg` functions. Create the source aggregates with the same parameters (same `frequency` for `freq_agg`, same `count` and `skew` for `mcv_agg`). The parameters are not checked: the result takes the parameters of one input aggregate, so a mismatch gives order-dependent results.

This produces a very similar aggregate to running the same aggregate function over all the source data. In most cases, any difference is no more than what you might get from simply reordering the input. However, if the source data for the different aggregates is very differently distributed, the rollup result may have looser frequency bounds.

## Arguments

The syntax is:

```
rollup(
    agg SpaceSavingAggregate
) RETURNS SpaceSavingAggregate
```

| Name  | Type                 | Default | Required | Description                                                       |
| ----- | -------------------- | ------- | -------- | ----------------------------------------------------------------- |
| `agg` | SpaceSavingAggregate | -       | ✔        | The aggregates to roll up. Create these with the same parameters. |

## Returns

| Column   | Type                 | Description                                                                                                 |
| -------- | -------------------- | ----------------------------------------------------------------------------------------------------------- |
| `rollup` | SpaceSavingAggregate | An aggregate containing the most common elements from all of the underlying data for all of the aggregates. |
