How to Refresh a Materialized View in Redshift

Manually Refresh:

Below is the syntax to manually refresh a materialized view where mv_name is the name of the materialized view.

REFRESH MATERIALIZED VIEW mv_name;

Enable Auto Refresh:

You can enable auto refresh of a materialized view using below syntax. Redshift refreshes materialized view as soon as possible after the underlying tables are updated.

ALTER MATERIALIZED VIEW mv_name AUTO REFRESH YES;

Schedule MV Refresh:

You can also schedule the sql statement to refresh materialized view using Redshift sql scheduler.

See also  Redshift - RANK Vs DENSE_RANK Window functions