Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ew8Lj-0006u1-Pg for pgsql-performance@arkaria.postgresql.org; Wed, 14 Mar 2018 15:29:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ew8Li-0004fa-K8 for pgsql-performance@arkaria.postgresql.org; Wed, 14 Mar 2018 15:29:54 +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.89) (envelope-from ) id 1ew8Li-0004fH-Cp for pgsql-performance@lists.postgresql.org; Wed, 14 Mar 2018 15:29:54 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ew8Le-0007lC-Hq for pgsql-performance@postgresql.org; Wed, 14 Mar 2018 15:29:53 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w2EFTi9a025801; Wed, 14 Mar 2018 11:29:44 -0400 From: Tom Lane To: Alvaro Herrera cc: =?utf-8?B?5b2t5pix5YKR?= , pgsql-performance@postgresql.org Subject: Re: Too many .history file in pg_xlog takes lots of space In-reply-to: <20180314134958.yzp2pze2s2yajf7k@alvherre.pgsql> References: <20180314134958.yzp2pze2s2yajf7k@alvherre.pgsql> Comments: In-reply-to Alvaro Herrera message dated "Wed, 14 Mar 2018 10:49:58 -0300" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <25799.1521041384.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Wed, 14 Mar 2018 11:29:44 -0400 Message-ID: <25800.1521041384@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Alvaro Herrera writes: > 彭昱傑 wrote: >> Every time I restart postgre server, it generates a new history file: > That's strange -- it shouldn't happen ... sounds like you're causing a > crash each time you restart. Are you using immediate mode in shutdown > maybe? If so, don't; use fast mode instead. I'm confused by this report too. Plain crashes shouldn't result in forking a new timeline. To check, I tried "-m immediate", as well as "kill -9 postmaster", and neither of those resulted in a new .history file on restart. I wonder if the OP's restart process involves calling pg_resetxlog or something like that (which would be risky as heck). regards, tom lane