DROP_MATERIALIZED_VIEW(7pg14)
π DROP MATERIALIZED VIEW π
okay bestie, welcome to the DROP MATERIALIZED VIEW page β section 7, from the PostgreSQL 14.24 Documentation β and it's literally the manual for removing an existing materialized view from your database. no cap, this is the main-character cleanup command β¨.
β¨ NAME β¨
DROP_MATERIALIZED_VIEW β remove a materialized view. that's it, that's the name, and it's giving βbye-bye, materialized viewβ π.
πΈ SYNOPSIS πΈ
DROP MATERIALIZED VIEW [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]
π«Ά DESCRIPTION π«Ά
DROP MATERIALIZED VIEW drops an existing materialized view. simple. iconic.
but bestie, the owner check is real: to execute this command you must be the owner of the materialized view. no owner energy, no drop energy π .
π PARAMETERS π
IF EXISTSβ do not throw an error if the materialized view does not exist. a notice is issued in this case. so it's like βwe checked, she's not here, moving onβ π.nameβ the name (optionally schema-qualified) of the materialized view to remove. yes, schema-qualified is allowed, iykyk π§.CASCADEβ automatically 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.14). this is the βand everything that came with herβ option, lowkey a lot π.RESTRICTβ refuse to drop the materialized view if any objects depend on it. this is the default. so if you don't sayCASCADE, it's gonna be protective and say βnope, she has dependentsβ π.
π EXAMPLES π
this command will remove the materialized view called order_summary:
DROP MATERIALIZED VIEW order_summary;
slay. clean. done π.
π COMPATIBILITY π
DROP MATERIALIZED VIEW is a PostgreSQL extension. periodt.
π¦ SEE ALSO π¦
CREATE MATERIALIZED VIEW(CREATE_MATERIALIZED_VIEW(7))ALTER MATERIALIZED VIEW(ALTER_MATERIALIZED_VIEW(7))REFRESH MATERIALIZED VIEW(REFRESH_MATERIALIZED_VIEW(7))
mwah π this cute little sign-off is brought to you by PostgreSQL 14.24, dated 2026, and yes, it's still the DROP MATERIALIZED VIEW(7) manual page. bye bestie, go drop responsibly π«Άβ¨
π¦ where this page comes from
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms