DROP MATERIALIZED VIEW - Amazon Redshift
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

DROP MATERIALIZED VIEW

Removes a materialized view.

For more information about materialized views, see Creating materialized views in Amazon Redshift.

Syntax

DROP MATERIALIZED VIEW [ IF EXISTS ]  mv_name
            

Parameters

IF EXISTS

A clause that specifies to check if the named materialized view exists. If the materialized view doesn't exist, then the DROP MATERIALIZED VIEW command returns an error message. This clause is useful when scripting, to keep the script from failing if you drop a nonexistent materialized view.

mv_name

The name of the materialized view to be dropped.

Usage Notes

Only the owner of a materialized view can use DROP MATERIALIZED VIEW on that view. A superuser or a user who has specifically been granted DROP privileges can be exceptions to this.

When you write a drop statement for a materialized view and a view with a matching name exists, it results in an error that instructs you to use DROP VIEW. An error occurs even in a case where you use DROP MATERIALIZED VIEW IF EXISTS.

Example

The following example drops the tickets_mv materialized view.

DROP MATERIALIZED VIEW tickets_mv;