Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dT8gX-0001IZ-T2 for pgsql-performance@arkaria.postgresql.org; Thu, 06 Jul 2017 15:27:18 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dT8gX-0000SD-Dp for pgsql-performance@arkaria.postgresql.org; Thu, 06 Jul 2017 15:27:17 +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 1dT8em-0005m6-Vj for pgsql-performance@postgresql.org; Thu, 06 Jul 2017 15:25:29 +0000 Received: from mail-it0-x235.google.com ([2607:f8b0:4001:c0b::235]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1dT8ej-0000RJ-QN for pgsql-performance@postgresql.org; Thu, 06 Jul 2017 15:25:28 +0000 Received: by mail-it0-x235.google.com with SMTP id v202so5765372itb.0 for ; Thu, 06 Jul 2017 08:25:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=M1aIkpIVjZfsKkwdnVeu2MfcLtQOdqCkvKNCyBFCrU0=; b=RLkMbgTbVVP8K/uJgfGHg7znRJcKzxUfD9Z3Lh0OqlbFN9y+FBah/DjHChG50q8VVt YQh1aWpB0NPRfYeJD0nEOfWLNx77phgZSLZtbPm7i3IjBq3IP+9egbOMqabBn4yPWe7V caMw7bYTJm5ZAmGVqx/AJMnfIMWFTBANP+TrK3xDxhOS4oYYnMKedCUdBxBEYYqtmgEQ vuwuv18w5iAwwTzdfaGAH/DBT5lrpjde00jnp7abhl6/Sw2HZHIOvHmyxHkt408tPDMf AYtlRrHWRmDVTCMCqHFCZrumVNAcZH8kfPHPbhLuEhojMiei2Sp7gqimkmdSVg8PdpYJ mfhA== 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=M1aIkpIVjZfsKkwdnVeu2MfcLtQOdqCkvKNCyBFCrU0=; b=jldzCXk80nJvKHEESqhrABXwVGhQIsXVHpeFWhcuh6ldeaXE8HA+Rx2saFtCA/jNLF uffoTYdxTH0FIU0klQ54HZsUrxA8CqFslgOJ2xXE7B0J44ltbYCYwVdx40AB57kU5Dcy B0qe5x/eDWnRBEF/HB6EzFGPRxo5hvg8cZUdhF5KyDWdop0QN52nslHl2Qes0ZVWUofC 70Uw2aWGpXtZdcvHG9/+02bgy0lmESdj2/oGVbIZsuSUdtND9CwXcDM9Pp9DW7u39d1m maoywjtL52LRi33Qs7pbab9ntgTReXXF/IuZZRIhPS7V3gETb6jTgSxIwcb4dbJg6gxe xeog== X-Gm-Message-State: AKS2vOwGVtW4TCOxaMowy7nEF02Q0RnzGXkklnTnVG02mAXqPdBnP3a2 QKiATtZIsQ46nlT7+853e49GbUN/PeG7sII= X-Received: by 10.107.199.198 with SMTP id x189mr47898247iof.14.1499354723980; Thu, 06 Jul 2017 08:25:23 -0700 (PDT) MIME-Version: 1.0 Received: by 10.79.24.133 with HTTP; Thu, 6 Jul 2017 08:25:23 -0700 (PDT) In-Reply-To: References: From: Shaun Thomas Date: Thu, 6 Jul 2017 10:25:23 -0500 Message-ID: Subject: Re: partitioning materialized views To: Rick Otten Cc: "pgsql-performa." Content-Type: text/plain; charset="UTF-8" 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 > I'm curious if I'm overlooking other possible architectures or tools that might make this simpler to manage. One of the issues with materialized views is that they are based on views... For a concurrent update, it essentially performs a looped merge, which can be pretty ugly. That's the price you pay to be non-blocking. For this particular setup, I'd actually recommend using something like pglogical to just maintain a live copy of the remote table or wait for Postgres 10's logical replication. 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; You could still follow your partitioned plan if you don't want to update all of the data at once. Let's face it, 3-4 hours is still a ton of data transfer and calculation. -- Shaun M Thomas - 2ndQuadrant PostgreSQL Training, Services and Support shaun.thomas@2ndquadrant.com | www.2ndQuadrant.com -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance