Drop Materialized View (DROP MATERIALIZED VIEW)
Usage
The DROP MATERIALIZED VIEW command is used to drop an existing materialized view in order to release related resources.
Syntax
Parameter Description
| Parameter | Description |
|---|---|
IF EXISTS | Optional. If the materialized view does not exist, no error is thrown |
schema_name | Optional. The name of the schema |
mv_name | The name of the materialized view to drop |
Examples
Example 1: Drop a materialized view
Example 2: Safe drop (no error if the materialized view does not exist)
Example 3: Drop a materialized view in a specified schema
Example 4: Drop and restore
Notes
-
Object Type Matching: To drop a materialized view, you must use
DROP MATERIALIZED VIEW. UsingDROP TABLEwill result in an error: -
Batch Dropping Not Supported: The syntax
DROP MATERIALIZED VIEW mv1, mv2, mv3is not supported. You must drop each one individually. -
Data Recovery: Within the
data_retention_daysretention period, a dropped materialized view can be restored viaUNDROP TABLE. -
Dependency Check: Before dropping, confirm that the materialized view is no longer referenced by other queries or objects.
Related Documents
- CREATE MATERIALIZED VIEW: Create a materialized view
- UNDROP TABLE: Restore a dropped table / dynamic table / materialized view
