Skip to main content

REFRESH-MATERIALIZED-VIEW

REFRESH-MATERIALIZED-VIEW​

Name​

REFRESH MATERIALIZED VIEW

Description​

This statement is used to manually refresh the specified asynchronous materialized view

syntax:

REFRESH MATERIALIZED VIEW mvName=multipartIdentifier (partitionSpec | COMPLETE | AUTO)

Explanation:

Asynchronous refresh of data for a materialized view

  • AUTO: The calculation will determine which partitions of the materialized view are not synchronized with the base table. (Currently, if the base table is an external table, it is considered to be always synchronized with the materialized view. Therefore, if the base table is an external table, it is necessary to specify COMPLETE or designate the partitions to be refreshed), and then proceed to refresh the corresponding partitions accordingly.
  • COMPLETE: It will forcibly refresh all partitions of the materialized view without checking whether the partitions are synchronized with the base table.
  • partitionSpec: It will forcibly refresh the specified partitions without checking whether the partitions are synchronized with the base table.

Example​

  1. Refresh materialized view mv1 (automatically calculate the partition to be refreshed)

    REFRESH MATERIALIZED VIEW mv1 AUTO;
  2. Refresh partition named p_19950801_19950901和p_19950901_19951001

    REFRESH MATERIALIZED VIEW mv1 partitions(p_19950801_19950901,p_19950901_19951001);
  3. Force refresh of all materialized view data

    REFRESH MATERIALIZED VIEW mv1 complete;

Keywords​

REFRESH, MATERIALIZED, VIEW

Best Practice​