---
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. This function requires that the source aggregates have been created with the same parameters (same `min_freq` for `freq_agg`, same n-factor and `skew`, if used, for a `mcv_agg`).

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. These must have been created 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. |
