Materialize Logo

DROP VIEW

DROP VIEW removes a view from your Materialize instances. This works on both materialized and non-materialized views.

Conceptual framework

Materialize maintains views after you create them. If you no longer need the view, you can remove it.

Because views rely on receiving data from sources, you must drop all views that rely on a source before you can drop the source itself. You can achieve this easily using DROP SOURCE…CASCADE.

Syntax

DROP VIEW IF EXISTS view_name RESTRICT CASCADE
Field Use
IF EXISTS Do not return an error if the named view does not exist.
view_name The view you want to drop. You can find available view names through SHOW VIEWS.
RESTRICT Do not drop this view if any other views depend on it. (Default)
CASCADE Drop all views that depend on this view.

Examples

SHOW VIEWS;
my_view
DROP VIEW my_view;
DROP VIEW