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

Automatic Rewriting

Automatic rewriting of materialized views can match the execution plan during the logical plan generation phase and automatically rewrite it into a materialized view query statement.

  • Automatic rewriting authorization

    During automatic rewriting, permissions on all source tables and the materialized view must be verified simultaneously for the rewriting to occur.

  • Exact match (hash match)

    The hash value of the logical execution plan is stored in the table properties. The hash value is directly used for comparison to determine if there is a match. If a match is found, the query statement is rewritten.

  • Fuzzy match (plan match)

    The view's SQL statement is retrieved and re-parsed to generate a logical plan. All nodes of the execution plan are compared in detail in the background. If the execution plan is a subtree of the materialized view's execution plan, a match is found, and the query statement is rewritten.

    Compared to exact match, fuzzy match can cover a wider range. Even if the execution plans are not identical, there is a possibility of a match.