ALTER MATERIALIZED VIEW
Function
Modifies the properties of a materialized view.
![](https://support.huaweicloud.com/intl/en-us/sqlreference-830-dws/public_sys-resources/note_3.0-en-us.png)
This syntax is supported only by clusters of 8.3.0 or later.
Precautions
None
Syntax
ALTER MATERIALIZED VIEW [ IF EXISTS ] { materialized_view_name } [ ENABLE | DISABLE ] QUERY REWRITE; ALTER MATERIALIZED VIEW [ IF EXISTS ] { materialized_view_name } REFRESH [ COMPLETE ] [ ON DEMAND ] [ [ START WITH (timestamptz) ] | [ EVERY (interval) ] ]; ALTER MATERIALIZED VIEW { materialized_view_name } OWNER TO new_owner;
Parameter Description
- ENABLE | DISABLE QUERY REWRITE
Indicates whether to enable query rewriting for a materialized view.
After enabling query rewriting for the materialized view, you need to refresh the materialized view to ensure that the data in the view is the latest.
- REFRESH [ COMPLETE ] [ ON DEMAND ] [ [ START WITH (timestamptz) ] | [EVERY (interval)] ]
Modifies the method of refreshing a materialized view.
- OWNER TO new_owner
Examples
Enables query rewriting for a materialized view.
ALTER MATERIALIZED VIEW mv1 ENABLE QUERY REWRITE; NOTICE: REFRESH MATERIALIZED VIEW should be executed to enable query rewrite. ALTER MATERIALIZED VIEW
Helpful Links
CREATE MATERIALIZED VIEW, DROP MATERIALIZED VIEW, REFRESH MATERIALIZED VIEW
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot