Apache Hive Materialized View CommandsPDF version

ALTER MATERIALIZED VIEW REWRITE

You can change the behavior of Hive to enable or disable the rewriting of queries based on a particular materialized view.

ALTER MATERIALIZED VIEW [db_name.]materialized_view_name ENABLE|DISABLE REWRITE;
db_name.materialized_view_name
The database name followed by the name for the materialized view in dot notation.

To optimize performance, by default, Hive rewrites a query based on materialized views. You can change this behavior to manage query planning and execution manually. By setting the hive.materializedview.rewriting global property, you can manage query rewriting based on materialized views for all queries.

ALTER MATERIALIZED VIEW mydb.mv1 DISABLE REWRITE;