Timescale Cloud: Performance, Scale, Enterprise

Self-hosted products

MST

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
  • RENAME [COLUMN] clause to rename the continuous aggregate column
  • 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 <view_name> SET ( timescaledb.<option> = <value> [, ... ] )
NameTypeDescription
<view_name>TEXTName (optionally schema-qualified) of continuous aggregate view to be created.
NameTypeDescription
timescaledb.materialized_onlyTEXTEnable and disable real-time aggregation
timescaledb.compressTEXTEnable and disable compression
timescaledb.compress_orderbyTEXTOrder used by compression, specified in the same way as the ORDER BY clause in a SELECT query. The default is the descending order of the hypertable's time column.
timescaledb.compress_segmentbyTEXTColumn list on which to key the compressed segments. An identifier representing the source of the data such as device_id or tags_id is usually a good candidate. The default is no segment by columns.
timescaledb.compress_chunk_time_intervalTEXTEXPERIMENTAL: set compressed chunk time interval used to roll compressed chunks into. This parameter compresses every chunk, and then merges it into a previous adjacent chunk if possible, to reduce the total number of chunks in the hypertable. It should be set to a multiple of the current chunk interval. This option can be changed independently of other compression settings and does not require the timescaledb.compress argument.
timescaledb.enable_cagg_window_functionsBOOLEANEXPERIMENTAL: enable window functions on continuous aggregates. Support is experimental, as there is a risk of data inconsistency if the user is not careful. For example, in backfill scenarios, buckets could be missed.

To disable real-time aggregates for a continuous aggregate:

ALTER MATERIALIZED VIEW contagg_view SET (timescaledb.materialized_only);

To enable compression for a continuous aggregate:

ALTER MATERIALIZED VIEW contagg_view SET (timescaledb.compress);

To rename a column for a continuous aggregate:

ALTER MATERIALIZED VIEW contagg_view RENAME COLUMN old_name TO new_name;

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.

Keywords

Found an issue on this page?Report an issue or Edit this page in GitHub.