How to alter/change Materialized View TTL in the Clickhouse?

Viewed 835

I have a materialized view:

CREATE MATERIALIZED VIEW reporting_device_raw_data
ENGINE = MergeTree()
PARTITION BY toYYYYMM(ts)
ORDER BY (device_id, ts)
TTL ts + INTERVAL 3 MONTH
AS SELECT
    device_id,
    ts,
    value
FROM reporting_device_raw_data_null;

I tried to:

ALTER TABLE reporting_device_raw_data MODIFY TTL ts + INTERVAL 12 MONTH;

But got erorr:

DB::Exception: Alter of type 'MODIFY TTL' is not supported by storage MaterializedView.

What are possible workarounds?

1 Answers

Check show create database .... for database engine.

Ordinary database:

ALTER TABLE ".inner.reporting_device_raw_data" MODIFY TTL ts + INTERVAL 12 MONTH;

Atomic database:

select uuid from system.tables where name = 'reporting_device_raw_data';
ALTER TABLE ".inner_id.{uuid from prev. select}" MODIFY TTL ts + INTERVAL 12 MONTH;
Related