DROP_MATERIALIZED_VIEW(7pg14)

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

πŸ’… 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 say CASCADE, 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 πŸ¦‹


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