Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1jGmkN-0000Ge-IV for pgsql-general@arkaria.postgresql.org; Tue, 24 Mar 2020 16:49:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jGmkK-0004lW-JH for pgsql-general@arkaria.postgresql.org; Tue, 24 Mar 2020 16:49:44 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1jGmkJ-0004lO-Sl for pgsql-general@lists.postgresql.org; Tue, 24 Mar 2020 16:49:44 +0000 Received: from resqmta-ch2-09v.sys.comcast.net ([2001:558:fe21:29:69:252:207:41]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jGmkG-0005jI-2k for pgsql-general@lists.postgresql.org; Tue, 24 Mar 2020 16:49:43 +0000 Received: from resomta-ch2-15v.sys.comcast.net ([69.252.207.111]) by resqmta-ch2-09v.sys.comcast.net with ESMTP id GmKGjC6HrdWWZGmkAjcN4N; Tue, 24 Mar 2020 16:49:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=20190202a; t=1585068574; bh=njRj0RqVV8gfp4AQVyLh6j6xUABzdaGNGQinSPind/A=; h=Received:Received:Received:From:To:Subject:Date:Message-ID: MIME-Version:Content-Type; b=0P0B6/KxLc3tsBa0iuYPyQwUHtWb773LqS8Ms1+XKgdFPJbtgw1fbKAY/kwRaTPM5 VrA6iLWgt5SbFyt4k9AC30wWcMxzJOHXhUrSHIuraC4e2jwGC8iK4iXacw7eegkB4e ts+t+GitdEPp3LlzsucnBk5lPOWKw5Knx/Oq3s1wPmy5Jpq3Wn9nxb0Z7iBAS6PRls lCM70UJHk4o3CuPMANH9Ya9IaJ6vkFik76i/vX0JnqFEFfx+9inwCl1hm8n/zZ02e6 hr8WQozrhn5NomUZGieL5OWXGObN4SBXM3QPEjHKtxaUmaEhrg/fWAnJwl/EgXqY9b WSTMKp+SYRX/Q== Received: from jsievers.comcast.net ([12.30.159.20]) by resomta-ch2-15v.sys.comcast.net with ESMTPA id Gmk0j2FAZmvz6Gmk1jmg96; Tue, 24 Mar 2020 16:49:32 +0000 X-Xfinity-VAAS: gggruggvucftvghtrhhoucdtuddrgedugedrudehuddgiedvucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuvehomhgtrghsthdqtfgvshhipdfqfgfvpdfpqffurfetoffkrfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufhfffgjkfgfgggtsehttdertddtredtnecuhfhrohhmpeflvghrrhihucfuihgvvhgvrhhsuceoghhsihgvvhgvrhhsudelsegtohhmtggrshhtrdhnvghtqeenucfkphepuddvrdeftddrudehledrvddtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehhvghlohepjhhsihgvvhgvrhhsrdgtohhmtggrshhtrdhnvghtpdhinhgvthepuddvrdeftddrudehledrvddtpdhmrghilhhfrhhomhepghhsihgvvhgvrhhsudelsegtohhmtggrshhtrdhnvghtpdhrtghpthhtoheprghlrghinhdrrhgvmhhunhgusegsvghrthhstghhihdrtghomhdprhgtphhtthhopehpghhsqhhlqdhgvghnvghrrghlsehlihhsthhsrdhpohhsthhgrhgvshhqlhdrohhrgh X-Xfinity-VMeta: sc=-100.00;st=legit Received: from jsievers.enova.com (localhost [127.0.0.1]) by jsievers.comcast.net (Postfix) with ESMTP id 50F9D26005A; Tue, 24 Mar 2020 11:49:24 -0500 (CDT) From: Jerry Sievers To: Remund Alain Cc: "pgsql-general\@lists.postgresql.org" Subject: Re: avoid WAL for refresh of materialized view References: Date: Tue, 24 Mar 2020 11:49:24 -0500 In-Reply-To: (Remund Alain's message of "Tue, 24 Mar 2020 15:59:46 +0000") Message-ID: <87blolsnor.fsf@jsievers.enova.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Remund Alain writes: > Hi all > > > > We have PostgreSql 9.6 running and started to work with materialized > views. To refresh the materialized views, we set up a cron job that > refreshes the materialized views on a fix schedule. > > Since our materialized views cache quite some data, we noticed a > considerable increase in WAL files. It seems, that every refresh of a > materialized view is logged in the WAL. > > > > We tried to figure out how we can alter the materialized view to set > it to "UNLOGGED" but this does not seem possible. > > --> "alter materialized view xyz set UNLOGGED;" leads to "ERROR: > "xyz" is not a table, SQL state: 42809" > > > > Is there another way to avoid logging a refresh of a materialized > view in the WAL? > The workaround for this is to not use mat view at all but instead materialize the output into an unlogged table that you trunc before every refresh. HTH > > > Kind regards, > > Alain Remund > > > -- Jerry Sievers Postgres DBA/Development Consulting e: postgres.consulting@comcast.net