Re: [PERFORM] partitioning materialized views - Mailing list pgsql-performance

From Rick Otten
Subject Re: [PERFORM] partitioning materialized views
Date
Msg-id CAMAYy4L9msh+hzPwYPVypVrxDPa4U2A0AV_HmwBzO7rY_ThOhA@mail.gmail.com
Whole thread Raw
In response to Re: [PERFORM] partitioning materialized views  (Rick Otten <rottenwindfish@gmail.com>)
Responses Re: [PERFORM] partitioning materialized views
List pgsql-performance

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.

pgsql-performance by date:

Previous
From: Rick Otten
Date:
Subject: Re: [PERFORM] partitioning materialized views
Next
From: Shaun Thomas
Date:
Subject: Re: [PERFORM] partitioning materialized views