Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XHYH9-0007JJ-Vj for pgsql-bugs@arkaria.postgresql.org; Wed, 13 Aug 2014 13:07:36 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XHYH8-0002F4-Vs for pgsql-bugs@arkaria.postgresql.org; Wed, 13 Aug 2014 13:07:35 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XHYH8-0002Ey-Af for pgsql-bugs@postgresql.org; Wed, 13 Aug 2014 13:07:34 +0000 Received: from mail.anarazel.de ([217.115.131.40]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XHYH0-0001Ia-8B for pgsql-bugs@postgresql.org; Wed, 13 Aug 2014 13:07:33 +0000 Received: by mail.anarazel.de (Postfix, from userid 108) id 51FB8560002; Wed, 13 Aug 2014 15:07:25 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on mail X-Spam-Level: X-Spam-Status: No, score=-6.1 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from anarazel.de (p5DDC519D.dip0.t-ipconnect.de [93.220.81.157]) (Authenticated sender: andres@anarazel.de) by mail.anarazel.de (Postfix) with ESMTPSA id 77F70500001; Wed, 13 Aug 2014 15:07:21 +0200 (CEST) Received: by anarazel.de (Postfix, from userid 1000) id EBE981008B6; Wed, 13 Aug 2014 15:07:20 +0200 (CEST) Date: Wed, 13 Aug 2014 15:07:20 +0200 From: Andres Freund To: MauMau Cc: Pavan Deolasee , Tom Lane , "maxim.boguk" , Pg Bugs Subject: Re: BUG #10675: alter database set tablespace and unlogged table Message-ID: <20140813130720.GC28982@awork2.anarazel.de> References: <20140618101045.GG3115@awork2.anarazel.de> <20140618110240.GJ3115@awork2.anarazel.de> <11621.1403099146@sss.pgh.pa.us> <20140618141949.GC3968@awork2.anarazel.de> <246F964E3CEB4B8D85FC5876CA37CC36@maumau> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <246F964E3CEB4B8D85FC5876CA37CC36@maumau> X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org On 2014-08-13 21:57:08 +0900, MauMau wrote: > From: "Pavan Deolasee" > >>Anyone else has an opinion on this? > >> > >> > >Since I did not hear anything on this, I created a patch that adds a new > >flag to tell checkpointer to flush all pages to the disk. Tom (and even I) > >have reservations about the approach, but I would nevertheless leave it to > >the committer to decide. IMV we must fix this bug one way or the other. > >Otherwise users face risk of failing to do clean shutdown. > > I'm reviewing this patch. > > According to the approach of the patch, CREATE DATABASE also needs the new > flag to sync the unlogged tables before copying them from source database to > the new one. You need to check other places which do checkpointing. > I'm with Tom-san: I think it would be better for online checkpoints to sync > unlogged tables without a new flag. The reasons are: That'd mean that the next pointrelease will incur *significantly* higher IO in many setups. If you currently have a workload where all dirty buffers of unlogged tables fit in s_b you'll never have any OS writes. That'd completely change. A compromise would be to couple it to CHECKPOINT_IMMEDIATE and/or _FORCE instead of creating a new flag - I think this is actually what Tom proposed. I'd planned to look (and possibly) commit this patch soonish. If I have to decide it'd be a new flag. > * There's a greater danger of losing data during operating system restart. > For example, IIRC, Windows gives only 20 seconds to terminate all services > during OS shutdown. If many dirty buffers for unlogged tables linger in the > shared buffers, PostgreSQL service may fail to complete database shutdown. > Even if the online checkpoint writes out all dirty buffers, the possibility > of there being many dirty buffers at shutdown is not zero, but the > probability would be lower. Meh. That won't lead to data loss, just recovery on restart. And 20s isn't sufficient for any halfway busy database anyway. > * Unlogged tables are, as its name suggests, for better performance by not > writing WAL. Pft. They exist because they have higher performance due to lower durability guarantees. Should we really create CREATE UNLOGGED AND NOT WRITTEN UNTIL REALLY NECESSARY TABLE ...(...)? Greetings, Andres Freund -- Andres Freund http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs