DROP_MATERIALIZED_VIEW(7pg18)

๐Ÿ“ฆ version 18.6, in opensuse-leap 16.0

โœจ DROP_MATERIALIZED_VIEW ๐Ÿ’…

okay so bestie, welcome to the PostgreSQL 18.6 docs, page DROP_MATERIALIZED_VIEW(7) โ€” yes the man page name is literally DROP MATE...IZED VIEW(7) when your terminal is too narrow, she's iconic like that ๐ŸŽ€


๐ŸŒธ NAME ๐ŸŒธ

DROP_MATERIALIZED_VIEW โ€” bestie, this is the one that removes a materialized view. poof. gone. no cap ๐Ÿ’จ


๐Ÿฆ‹ SYNOPSIS ๐Ÿฆ‹

DROP MATERIALIZED VIEW [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]

look at her. short. powerful. main character energy fr fr ๐Ÿ‘‘


๐Ÿ’– DESCRIPTION ๐Ÿ’–

So DROP MATERIALIZED VIEW drops an existing materialized view. that's the whole vibe.

but the tea โ˜• โ€” to run this command you MUST be the owner of the materialized view. not your friend, not your coworker, you. own it or don't drop it, periodt.


๐ŸŽ€ PARAMETERS ๐ŸŽ€

  • IF EXISTS โ€” pls don't throw an error if the materialized view doesn't exist, we're being chill about it. a notice gets issued instead, so you still get a lil heads up ๐Ÿซถ
  • name โ€” the name of the materialized view you wanna remove. optionally schema-qualified, so you can be all myschema.myview about it if you want to be specific ๐Ÿ’…
  • CASCADE โ€” okay so this one goes feral ๐Ÿ˜ญ it automatically drops objects that depend on the materialized view (like other materialized views, or regular views), and then in turn all the objects that depend on those objects. it's a whole chain reaction, see Section 5.15. use with intention bestie, she does not stop at one ๐Ÿ”ฅ
  • RESTRICT โ€” the safe queen ๐Ÿ‘‘ she refuses to drop the materialized view if any objects depend on it. this is the default, so if you don't say anything, you get the cautious behavior. no accidental chaos. we love a boundary.

๐ŸŒˆ EXAMPLES ๐ŸŒˆ

this command will remove the materialized view called order_summary:

DROP MATERIALIZED VIEW order_summary;

ate. that's it. that's the whole thing โœจ


๐Ÿ’œ COMPATIBILITY ๐Ÿ’œ

DROP MATERIALIZED VIEW is a PostgreSQL extension. so like, she's ours, she's special, other databases don't have this exact move. iykyk ๐Ÿ’ซ


๐Ÿ“ SEE ALSO ๐Ÿ“

go read those too, the whole materialized view cinematic universe is worth your time ๐Ÿฆ‹


โš ๏ธ real talk bestie: CASCADE is not a joke. it will take the whole friend group down with it. if you're not sure, let RESTRICT (the default!) hold your hand ๐Ÿซถ

and that's the page!! brought to you by PostgreSQL 18.6, dated 2026, filed under DROP MATE...IZED VIEW(7) ๐Ÿ’– mwah, go drop responsibly, ily ๐ŸŽ€โœจ

๐Ÿ“ฆ where this page comes from