DROP_MATERIALIZED_VIEW(7pg15)

πŸ“¦ version 15.19, in opensuse-leap 16.0

πŸ’… 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 all myschema.myview about 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 🌈

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