DROP MATERIALIZED VIEW
Syntax
DROP MATERIALIZED VIEW [IF EXISTS] view_name
Description
This statement is used to delete a materialized view. If the view to be deleted does not exist and the if exists parameter is used, no error occurs.
If a materialized view is deleted, metadata and table data associated with it will also be deleted.
A materialized view will fail to delete if some data (metadata or table data) has been deleted before the materialized view is deleted.
Example
- Create a table.
hetuengine:tpcds_2gb> create table t1 (id int, c1 varchar); hetuengine:tpcds_2gb> Insert into t1 values (1,'abc'), (2,'abc2'), (3,'abc3'), (4,'abc4'), (5,'abc5'), (6,'abc6');
- Create a materialized view.
hetuengine:tpcds_2gb> create materialized view mv.tpcds.t1 as select c1 from t1 where id <7;
- Delete a specified view. If the view does not exist, an error occurs.
hetuengine:tpcds_2gb> drop materialized view mv.tpcds.t1; Query 20211206_095415_00003_k4wwu failed: line 1:1: MATERIALIZED VIEW 'mv.tpcds.t1' does not exist
- Delete a specified materialized view with the if exists parameter set. If the view exists, it will be deleted. If the view does not exist, no error occurs.
hetuengine:tpcds_2gb> drop materialized view if exists mv.tpcds.t1; DROP 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