Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dT9cu-0004Bm-65 for pgsql-performance@arkaria.postgresql.org; Thu, 06 Jul 2017 16:27:36 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dT9ct-0005AJ-MK for pgsql-performance@arkaria.postgresql.org; Thu, 06 Jul 2017 16:27:35 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dT9cs-000594-FM for pgsql-performance@postgresql.org; Thu, 06 Jul 2017 16:27:34 +0000 Received: from mail-qk0-x231.google.com ([2607:f8b0:400d:c09::231]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1dT9cn-0001mX-R5 for pgsql-performance@postgresql.org; Thu, 06 Jul 2017 16:27:33 +0000 Received: by mail-qk0-x231.google.com with SMTP id p21so6689486qke.3 for ; Thu, 06 Jul 2017 09:27:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=5W5+iYW/FUNvFGBeoH016xYvOH73/mElEuVN5LpIgWM=; b=LXlL1beNl0Rp6NmOkU6fmO+RgZrBgNk3Rpsn8/cf6O7FeZq3G8yNbx095Wp+oU6I4B uA8nHtMM7xDpZYAf75lOKNiKUBTMRJrS2R2Ooay9cA9o2PX3q9YSey6zxW9J+uxZAH33 CEqlIM8Le5IKsvTSC4Yp51FGNWZxKjRa2uI74XseDVQdQFPOTxYHJDC3MsgmNlr4Eskt iO1gJm5E/GPIZGhB6DYxJ5LxHkh70GBd1kdXaMeXQkqjIE7x7AUETjIoZ+r/iHh8db11 Pg5GXuVQXMWxa+a0H8EKPTWagVAvEXWQE4NjApUiDklExR5IMXC1ht3SFxu9IoxRYWXz 5uVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=5W5+iYW/FUNvFGBeoH016xYvOH73/mElEuVN5LpIgWM=; b=CFIj4fdWeaYO5ZcwZJPg4S29xAf6/2FXoGPiYhq6sfcUUwkttnnLVDz6lCIUTiGlZh e7DUvVfmIKb2IVi3c9zSQ3i4maRPwSrP6eVdDE9BiqRGClmVFKcgpV/noleNaYjPeaK3 0WpvR0QtFKHIi4HVnJ/DWb/QBRDGf6Ch5SgeEEVle1a/qGf1df5cMGM93LEL0KeFnWUR YPRy25qBaHu9fQTUZnMuliXrl+QPGnH0k/sexuIytgYnD1eJnSe9lGhyOYSj4h6sRYzc 8QvulbXFT3jw5kyw2pyYkiVPzAtK7n6nupiENDfCTHqBqNn/G4+dKO7EthllhJNt/oO/ 5N6A== X-Gm-Message-State: AKS2vOzc6KjMthhuSvPVqwmjFMzHZqSzkBGebups1+A5BUUrVbm37t+K F/OMnt4VcBBJ+n3fTSHUVv9zhPylMQ== X-Received: by 10.55.53.148 with SMTP id c142mr57118479qka.88.1499358448076; Thu, 06 Jul 2017 09:27:28 -0700 (PDT) MIME-Version: 1.0 Received: by 10.12.177.40 with HTTP; Thu, 6 Jul 2017 09:27:27 -0700 (PDT) In-Reply-To: References: From: Rick Otten Date: Thu, 6 Jul 2017 12:27:27 -0400 Message-ID: Subject: Re: partitioning materialized views To: Shaun Thomas Cc: "pgsql-performa." Content-Type: multipart/alternative; boundary="001a114711b0b04d730553a897cf" List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org --001a114711b0b04d730553a897cf Content-Type: text/plain; charset="UTF-8" > > > 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. --001a114711b0b04d730553a897cf Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

= 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.=C2=A0 Thanks!=C2= =A0 I'll ponder that one.

<= /div>

I = don't think the downstream dependencies will let that work without rebu= ilding them as well. =C2=A0 The drop fails (without a cascade), and the oth= er views and matviews that are built off of this all simply point to x_old.=

--001a114711b0b04d730553a897cf--