All Products
Search
Document Center

MaxCompute:SELECT MATERIALIZED VIEW

Last Updated:Mar 26, 2026

Queries the status of a materialized view to determine whether it is valid and view changes to the source table.

Materialized view states

A materialized view is either valid or invalid:

StateQuery behavior
ValidMaxCompute reads data directly from the materialized view. Query acceleration takes effect.
InvalidMaxCompute falls back to reading from the source table. Query acceleration does not take effect.

Check validity

Syntax

Boolean materialized_view_is_valid(<mv_name>, <partition>);

Return value

  • true: the materialized view data is consistent with the source table.

  • false: the materialized view data is out of sync. Query acceleration is not active.

Parameters

ParameterRequiredDescription
<mv_name>YesName of the materialized view, enclosed in double quotes.
<partition>NoPartition value. For level-2 partitions, pass values for each partition level as separate arguments.

Examples

Check a non-partitioned materialized view:

SELECT materialized_view_is_valid("mf_mv_refresh4");

Check a specific partition:

-- Level-1 partition
SELECT materialized_view_is_valid("mf_mv_refresh_pts", "20220810");

-- Level-2 partition
SELECT materialized_view_is_valid("mf_mv_refresh_pts_part", "20220810", "beijing");

What's next