DROP MATERIALIZED VIEW
remove a materialized view
English manual coverage begins with PostgreSQL 6.4. Source history and runtime observations have their own recorded version boundaries.
Reading PG 18·Select a recorded version
- anchor
- SQL-DROPMATERIALIZEDVIEW
- file
- sql-dropmaterializedview.html
- lang
- en
- name
- DROP MATERIALIZED VIEW
- purpose
- remove a materialized view
- purpose zh
- 移除一个物化视图
- sections same as
- Unknown
- slug
- 18
- synopsis html
- DROP MATERIALIZED VIEW [ IF EXISTS ] <em class="replaceable"><code>name</code></em> [, ...] [ CASCADE | RESTRICT ]
- synopsis text
- DROP MATERIALIZED VIEW [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]
Syntax
DROP MATERIALIZED VIEW [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]Syntax diagrams
Read left to right. Branches are choices, bypasses are optional, loops repeat. Select an underlined parameter to open its rule.
Definition PG 18
DROP MATERIALIZED VIEW [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]
Description
DROP MATERIALIZED VIEW drops an existing materialized view. To execute this command you must be the owner of the materialized view.
Parameters
IF EXISTSDo not throw an error if the materialized view does not exist. A notice is issued in this case.
nameThe name (optionally schema-qualified) of the materialized view to remove.
CASCADEAutomatically drop objects that depend on the materialized view (such as other materialized views, or regular views), and in turn all objects that depend on those objects (see Section 5.15).
RESTRICTRefuse to drop the materialized view if any objects depend on it. This is the default.
Examples
This command will remove the materialized view called order_summary:
DROP MATERIALIZED VIEW order_summary;
Compatibility
DROP MATERIALIZED VIEW is a PostgreSQL extension.
See Also
CREATE MATERIALIZED VIEW, ALTER MATERIALIZED VIEW, REFRESH MATERIALIZED VIEWCompare versions
Source references
Full definition and evidence JSON
Definition sources
center · PostgreSQL 18 · wiki-repair-20261023:e688515d68e0e53e2cb6b5e53ae0e512fee39b59880372afe87d0d7d8937f524
Text language: en · wiki-repair-20261023:e688515d68e0e53e2cb6b5e53ae0e512fee39b59880372afe87d0d7d8937f524