timescale / timescaledb-backup

Other
35 stars 9 forks source link

Can this backup continuous aggregates (MATERIALIZED VIEWS)? #42

Closed Rotario closed 3 years ago

Rotario commented 3 years ago

I've been trying out TimescaleDB and I can't understand how backups work if the "source" timeseries data is deleted with a retention_policy

If I've got this simple schema timeseries hypertable aggregate data calculated in 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. Let's say I make a backup with pg_dump (as recommended by [3]) or ts_dump. Since pg_dump 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

davidkohn88 commented 3 years ago

Both will backup continuous aggregates because they are not materialized views internally, internally, they are actually hypertables and views, we just intercept and use the materialized view syntax for their creation etc and to build on the concept.

davidkohn88 commented 3 years ago

Closing this, but if you have more questions, feel free to reopen.