If you _can't_ do that due to cloud restrictions, you'd actually be better off doing an atomic swap.
CREATE MATERIALIZED VIEW y AS ...;
BEGIN; ALTER MATERIALIZED VIEW x RENAME TO x_old; ALTER MATERIALIZED VIEW y RENAME TO x; DROP MATERIALIZED VIEW x_old; COMMIT;
This is an interesting idea. Thanks! I'll ponder that one.
I don't think the downstream dependencies will let that work without rebuilding them as well. The drop fails (without a cascade), and the other views and matviews that are built off of this all simply point to x_old.