Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XHbfv-0007Le-De for pgsql-bugs@arkaria.postgresql.org; Wed, 13 Aug 2014 16:45:23 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XHbfu-000845-TY for pgsql-bugs@arkaria.postgresql.org; Wed, 13 Aug 2014 16:45:22 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XHbft-00083w-RT for pgsql-bugs@postgresql.org; Wed, 13 Aug 2014 16:45:21 +0000 Received: from mimolette.dalibo.net ([212.85.154.222]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XHbfn-0002Of-0Y for pgsql-bugs@postgresql.org; Wed, 13 Aug 2014 16:45:19 +0000 Received: from [192.168.42.201] (unknown [37.162.15.212]) by mimolette.dalibo.net (Postfix) with ESMTPSA id D41FE5080460; Wed, 13 Aug 2014 18:45:00 +0200 (CEST) Message-ID: <53EB95C9.1020004@dalibo.com> Date: Wed, 13 Aug 2014 18:43:53 +0200 From: Vik Fearing User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0 MIME-Version: 1.0 To: Andres Freund , MauMau CC: Pavan Deolasee , Tom Lane , "maxim.boguk" , Pg Bugs Subject: Re: BUG #10675: alter database set tablespace and unlogged table References: <20140618101045.GG3115@awork2.anarazel.de> <20140618110240.GJ3115@awork2.anarazel.de> <11621.1403099146@sss.pgh.pa.us> <20140618141949.GC3968@awork2.anarazel.de> <246F964E3CEB4B8D85FC5876CA37CC36@maumau> <20140813130720.GC28982@awork2.anarazel.de> <149312E3EED04551A6E5F394AF029DF2@maumau> <20140813143258.GD28982@awork2.anarazel.de> In-Reply-To: <20140813143258.GD28982@awork2.anarazel.de> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.9 (-) 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 08/13/2014 04:32 PM, Andres Freund wrote: > On 2014-08-13 23:31:46 +0900, MauMau wrote: >> From: "Andres Freund" >>> 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. >> >> Yes, that's the only headache... But I'm not worried so much, because >> bgwriter and/or backends may write out dirty buffers for unlogged tables, so >> the total I/O is not low anyway. > > If the workload fits in s_b - not an infrequent thing with today's > memory sizes - that's simply not true. > >>>> * 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. >> >> The unlogged tables are emptied (= data loss) at recovery restart. > > If that's data loss you shouldn't be using unlogged tables. That's not > an argument. There is also this issue which has been bugging me for a while but I haven't had time to look at providing a patch for: postgres=# create unlogged table t (id integer); CREATE TABLE postgres=# insert into t values (1); INSERT 0 1 postgres=# create index on t using hash (id); CREATE INDEX postgres=# set enable_seqscan = off; SET postgres=# select * from t where id = 1; ERROR: index "t_id_idx" contains unexpected zero page at block 0 HINT: Please REINDEX it. All because the init fork is never checkpointed to disk. If there's anywhere a hash index should be safe to use, it's on unlogged tables. -- Vik -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs