Add compression without refresh policy

I have a continuous aggregate that I refresh manually every hour, for a specific 1 hour timeframe with some lag from the current hour. I don’t want to add a refresh policy that will interfere with this, as it is part of a batch process with other dependencies. I want to add compression for older data that is not being updated, but getting this error:
ERROR: setup a refresh policy for “MV” before setting up a compression policy.
How can I add compression in this case? Or can I/should I be using a regular MV for this?

I think you missed the alter materialized view .

You can see there’s a compression option there.


alter materialized view <cagg-name> set (timescaledb.compression=true);

Thanks for the response. I did add compression but I am getting this error:

ALTER materialized view <view name> SET (
  timescaledb.compress,
  timescaledb.compress_segmentby = '<columns>',
    timescaledb.compress_orderby = '<columns>'  
);
ALTER MATERIALIZED VIEW

SELECT public.add_compression_policy('<view name>', INTERVAL '7 days');
ERROR:  setup a refresh policy for "<view name>" before setting up a compression policy

Is it like a single transaction command sent? just thinking if this is a problem of running both commands in the same transaction?