DROP_MATERIALIZED_VIEW(7pg15)
π DROP MATERIALIZED VIEW(7)
ok so bestie, this is the DROP MATERIALIZED VIEW page from the PostgreSQL 15.19 Documentation β yes, the big one, the 7pg15 one, we're here, we made it π
β¨ NAME β¨
DROP_MATERIALIZED_VIEW β remove a materialized view
like, yeet it. gone. that's the whole vibe π«Ά
π SYNOPSIS π
DROP MATERIALIZED VIEW [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]
look at her. so clean. so iconic. everything in brackets is optional and she knows it π
πΈ DESCRIPTION πΈ
DROP MATERIALIZED VIEW drops an existing materialized view. that's it, that's the job, and she does it flawlessly β¨
but listen β to run this command you must be the owner of the materialized view. no owner, no drop. it's giving "you can't sit with us" energy, ngl π
π¦ PARAMETERS π¦
okay bestie, here's the whole menu, no skips, we're reading all of it:
IF EXISTSβ do not throw an error if the materialized view does not exist. instead, a notice is issued in this case. so like, if it's not there, we don't cry about it, we just get a little notice and move on πnameβ the name (optionally schema-qualified) of the materialized view to remove. yes, optionally schema-qualified, so you can be allmyschema.myviewabout it if you want to be fancy π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). β οΈ bestie this one SPREADS β it's lowkey the "and everyone she's ever known" button, so be sure before you press it π₯RESTRICTβ refuse to drop the materialized view if any objects depend on it. and heads up: this is the default. she's cautious like that, main character energy with a safety net π
π EXAMPLES π
this command will remove the materialized view called order_summary:
DROP MATERIALIZED VIEW order_summary;
and that's it. one line. ate and left no crumbs πβ¨
π COMPATIBILITY π
DROP MATERIALIZED VIEW is a PostgreSQL extension. so like, she's homegrown, she's not standard SQL, she's our girl π
π SEE ALSO π
CREATE MATERIALIZED VIEW(CREATE_MATERIALIZED_VIEW(7))ALTER MATERIALIZED VIEW(ALTER_MATERIALIZED_VIEW(7))REFRESH MATERIALIZED VIEW(REFRESH_MATERIALIZED_VIEW(7))
the whole friend group, fr fr π«Ά
okay and finally, the cute little sign-off: this whole page is brought to you by PostgreSQL 15.19, dated 2026, and honestly? she's still serving after all these years πβ¨ drop responsibly bestie π
π¦ where this page comes from
- opensuse-leap 16.0: postgresql15 15.19-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql15 15.19-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql15 15.19-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql15 15.19-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