Skip to main content

EXPLAIN MATERIALIZED VIEW

Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime

Provides information about whether a query can be incrementalized when being refreshed for a materialized view.

To learn about materialized view incrementalization, see Incremental refresh for materialized views.

important

EXPLAIN MATERIALIZED VIEW confirms structural eligibility for incrementalization. It does not guarantee an incremental refresh will be executed when using the AUTO policy. In that mode, the cost model still chooses a full recompute at runtime if factors like changeset size make a full refresh cheaper. The REFRESH POLICY INCREMENTAL and REFRESH POLICY INCREMENTAL STRICT policies override this cost model decision.

Syntax

EXPLAIN MATERIALIZED VIEW FOR query

Parameters

  • query

    A SQL query for a materialized view to be explained.

Examples

SQL
EXPLAIN MATERIALIZED VIEW FOR select k, sum(v) from source.src_schema.table group by k;
+----------------------------------------------------+
| plan|
+----------------------------------------------------+
| == Physical Plan ==
*(2) HashAggregate(keys=[k#33], functions=[sum(cast(v#34 as bigint))])
+- Exchange hashpartitioning(k#33, 200), true, [id=#59]
+- *(1) HashAggregate(keys=[k#33], functions=[partial_sum(cast(v#34 as bigint))])
+- *(1) LocalTableScan [k#33, v#34]
|
+----------------------------------------------------