grzesiu988
grzesiu988

Reputation: 244

Is it possible to add new aggregated column for TimescaleDB continuous aggregate view?

I've already have TimescaleDB continuous aggregate view. I want add one column with aggregated minimum values. I don't want recreate, because the view has older data than basic. Does TimescaleDB support this action?

Upvotes: 2

Views: 957

Answers (1)

Attila Toth
Attila Toth

Reputation: 307

No you cannot alter columns in continuous aggregates (yet). You need to drop it and recreate it with the proper columns.

Edit: In case you have data in the cont. agg based on older data that's not available anymore in the hypertable, you have two options:

OPTION 1: Insert the materialized data back into the hypertable. Then create the new cont. agg. with the new column(s) + need to disable the data retention policy until the new CAgg is done refreshing the older data. (Important: with this solution, if you run sth like AVG() the data that comes back might not be totally accurate)

OPTION 2: UNION the old cont. agg. when querying the new one (in this case you wouldn't have the new column(s) for older data)

Upvotes: 1

Related Questions