How does TimescaleDB backup continuous aggregates when they're materialized views?

Viewed 175

I've been trying out TimescaleDB and I can't understand how backups work with the following system?

timeseries hypertable -> aggregated by a MATERIALIZED VIEW continuous aggregate

Now if I have a data retention policy on the timeseries table that drops anything older than, say, a week. If I make a backup with pg_dump (as recommended by [3]), since it doesn't backup materialized views[1], which is what continuous aggregates are. Then I lose all data from the timeseries hypertable older than a week and the corresponding continuous aggregate data.

Is this the intended behaviour?

References:

[1] pg_dump utility

data retention

[3] backup and restore

1 Answers

TimescaleDB Continuous Aggregates are not really materialized views, they are more complicated than this. The data is stored in a hypertable internally, called the materialized hypertable. If you run pg_dump to dump the continuous aggregate, it will write out the contents of the chunks of this hypertable to the dump.

Related