Updated on 2026-11-06 GMT+08:00

Configuration Parameters

Parameter

Description

Default Value

spark.sql.materialized.views.location

Specifies the storage location for regular materialized views. Does not apply to intelligent materialized views.

If this parameter is not specified, Spark uses the default storage location.

-

spark.sql.materialized.views.rewrite.enabled

Controls whether materialized view query rewriting is enabled.

Query rewriting means that when executing a query, Spark attempts to rewrite the query to use a materialized view to improve query performance.

  • true: Enables materialized view query rewriting.
  • false: Does not attempt to rewrite queries to use materialized views.

false

spark.sql.materialized.views.calcite.timeoutSeconds

Controls the maximum timeout for the Calcite planner during query rewriting, in seconds.

If the Calcite planner does not complete query rewriting within the specified time, Spark abandons using the materialized view and executes the query as-is.

10

spark.sql.cte.mv.enabled

Eligible CTE definitions will be materialized asynchronously after query execution. If a structurally identical CTE body query appears later, it will be replaced by a simple scan of the materialized view instead of recomputation. (Session-level enabling/disabling is currently not supported but will be in the future.)

  • true: Enable CTE materialization.
  • false: Disable CTE materialization.

false

spark.sql.cte.mv.viewPrefix

The prefix for temporary view names created by the CTE materialization feature.

cte

spark.sql.cte.mv.database

The database name for storing CTE materialized views.

default

spark.sql.materialized.views.cte.hash.match

Controls whether hash matching mode is enabled for materialized view query rewriting.

Hash matching mode can hit materialized views faster, but the disadvantage is that the rewritten SQL must exactly match the logical execution plan of the materialized view. Otherwise, it cannot be hit.

  • true: Enable hash matching mode.
  • false: Disable hash matching mode.

false