ALTER MATERIALIZED VIEW (Continuous Aggregate)

ALTER MATERIALIZED VIEW statement can be used to modify some of the WITH clause options for the continuous aggregate view. ALTER MATERIALIZED VIEW statement also supports the following PostgreSQL clauses on the continuous aggregate view:

  • RENAME TO clause to rename the continuous aggregate view;
  • SET SCHEMA clause to set the new schema for the continuous aggregate view;
  • SET TABLESPACE clause to move the materialization of the continuous aggregate view to the new tablespace;
  • OWNER TO clause to set new owner for the continuous aggregate view.

    ```

ALTER MATERIALIZED VIEW SET ( timescaledb.

  1. ### Parameters
  2. <table><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td><code>&lt;view_name&gt;</code></td><td>TEXT</td><td>Name (optionally schema-qualified) of continuous aggregate view to be created.</td></tr></tbody></table>
  3. ### Options
  4. <table><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td>timescaledb.materialized_only</td><td>Enable and disable real time aggregation</td></tr><tr><td>timescaledb.compress</td><td>Enable and disable compression</td></tr></tbody></table>
  5. ### Sample usage
  6. To disable real-time aggregates for a continuous aggregate:

ALTER MATERIALIZED VIEW contagg_view SET (timescaledb.materialized_only = true);

  1. To enable compression for a continuous aggregate:

ALTER MATERIALIZED VIEW contagg_view SET (timescaledb.compress = true); ```

The only options that currently can be modified with ALTER MATERIALIZED VIEW are materialized_only and compress. The other options continuous and create_group_indexes can only be set when creating the continuous aggregate.