---
title: rollup() | Tiger Data Docs
description: Combine multiple timevectors into a single timevector for re-aggregation
---

Early access [1.3.0](https://github.com/timescale/timescaledb-toolkit/releases/tag/1.3.0)

Combine multiple pre-constructed timevectors into a single timevector. This is useful for re-aggregating timevectors that were created separately, such as when grouping by different dimensions or combining data from multiple sources.

## Samples

### Combine timevectors from different groups

Aggregate per-device timevectors into a single combined timevector:

```
CREATE TABLE samples(time TIMESTAMPTZ, batch INT, data DOUBLE PRECISION);


-- Create timevectors per batch
CREATE VIEW batch_series AS
    SELECT batch, timevector(time, data) AS batch_series
    FROM samples
    GROUP BY batch;


-- Combine all batches into one timevector
SELECT rollup(batch_series)
FROM batch_series;
```

### Re-aggregate across partitions

Combine timevectors from different time ranges:

```
CREATE VIEW daily_series AS
    SELECT
        date_trunc('day', time) AS day,
        timevector(time, temperature) AS series
    FROM sensor_data
    GROUP BY 1;


-- Get weekly timevector from daily timevectors
SELECT
    date_trunc('week', day) AS week,
    rollup(series) AS weekly_series
FROM daily_series
GROUP BY 1;
```

## Arguments

The syntax is:

```
rollup(
    series Timevector
) RETURNS Timevector
```

| Name   | Type       | Default | Required | Description                                          |
| ------ | ---------- | ------- | -------- | ---------------------------------------------------- |
| series | Timevector | -       | ✔        | Previously constructed timevector objects to combine |

## Returns

| Column | Type       | Description                                      |
| ------ | ---------- | ------------------------------------------------ |
| rollup | Timevector | A timevector combining all the underlying series |
