REFRESH MATERIALIZED VIEW

info

Materialized View support is in beta.

It may not be fit for production use.

To enable beta materialized views, set cairo.mat.view.enabled=true in server.conf, or export the equivalent environment variable: QDB_CAIRO_MAT_VIEW_ENABLED=true.

Please let us know if you run into issues.

Either:

  1. Email us at support@questdb.io
  2. Join our public Slack
  3. Post on our Discourse community

REFRESH MATERIALIZED VIEW refreshes a materialized view. This is helpful when a view becomes invalid, and no longer refreshes incrementally.

When the FULL keyword is specified, this command deletes the data in the target materialized view and inserts the results of the query into the view. It also marks the materialized view as valid, reactivating the incremental refresh processes.

When the INCREMENTAL keyword is used, the REFRESH command schedules an incremental refresh of the materialized view. Usually, incremental refresh is automatic, so this command is useful only in niche situations when incremental refresh is not working as expected, but the view is still valid.

Syntax

Flow chart showing the syntax of the REFRESH MATERIALIZED VIEW keyword

Examples

REFRESH MATERIALIZED VIEW trades_1h FULL;
REFRESH MATERIALIZED VIEW trades_1h INCREMENTAL;

See also

For more information on the concept, see the reference on materialized views.