---
title: cagg_migrate() | Tiger Data Docs
description: Migrate a continuous aggregate from the old format to the new format introduced in TimescaleDB 2.7
---

Sunsetted [2.25.0](https://github.com/timescale/timescaledb/releases/tag/2.25.0)\
Since [2.7.0](https://github.com/timescale/timescaledb/releases/tag/2.7.0)

Migrate a continuous aggregate from the old format to the new format introduced in TimescaleDB 2.7.

```
CALL cagg_migrate (
    cagg REGCLASS,
    override BOOLEAN DEFAULT FALSE,
    drop_old BOOLEAN DEFAULT FALSE
);
```

TimescaleDB 2.7 introduced a new format for continuous aggregates that improves performance. It also makes continuous aggregates compatible with more types of SQL queries.

The new format, also called the finalized format, stores the continuous aggregate data exactly as it appears in the final view. The old format, also called the partial format, stores the data in a partially aggregated state.

Use this procedure to migrate continuous aggregates from the old format to the new format.

For more information, see the [migration how-to guide](/docs/build/continuous-aggregates/migrate-to-new-form/index.md).

Warning

There are known issues with `cagg_migrate()` in version TimescaleDB 2.8.0. Upgrade to version 2.8.1 or above before using it.

## Arguments

The syntax is:

```
CALL cagg_migrate(
    cagg = '<view_name>',
    override = true | false,
    drop_old = true | false
);
```

| Name       | Type       | Default | Required | Description                                                                                                                                                                                                                                                                 |
| ---------- | ---------- | ------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `cagg`     | `REGCLASS` | -       | ✔        | The continuous aggregate to migrate                                                                                                                                                                                                                                         |
| `override` | `BOOLEAN`  | `false` | -        | If false, the old continuous aggregate keeps its name. The new continuous aggregate is named `<OLD_CONTINUOUS_AGGREGATE_NAME>_new`. If true, the new continuous aggregate gets the old name. The old continuous aggregate is renamed `<OLD_CONTINUOUS_AGGREGATE_NAME>_old`. |
| `drop_old` | `BOOLEAN`  | `false` | -        | If true, the old continuous aggregate is deleted. Must be used together with `override`.                                                                                                                                                                                    |

## Returns

This function returns void.
