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.89) (envelope-from ) id 1ghGOH-0001eJ-MO for pgsql-bugs@arkaria.postgresql.org; Wed, 09 Jan 2019 16:07:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ghGOG-0002nB-BH for pgsql-bugs@arkaria.postgresql.org; Wed, 09 Jan 2019 16:07:36 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ghGOG-0002n4-1P for pgsql-bugs@lists.postgresql.org; Wed, 09 Jan 2019 16:07:36 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ghGOC-0003tF-Sm for pgsql-bugs@lists.postgresql.org; Wed, 09 Jan 2019 16:07:34 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id CF2C2213CA; Wed, 9 Jan 2019 11:07:31 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Wed, 09 Jan 2019 11:07:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= date:from:to:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm3; bh=NYZrb1LXZVTVb4+x3yY6JN2WDZ6 gbGbPORE0ET1zdug=; b=KDauAo781i6YPw8bG4v5p66CgQcgtpk93G2PtnlEBYq ZNkpdgRk2TxqkO7qM1i9ZO1+pzV8G4U9pXtySLmtOY3Cejoz/gV+VSr2aTlFr1H3 3dO1u/ddxdthrted7DKNf7ziD0RPsruTStW/0SxtKNpilYWJQ7KzQqaWZYnfpLMm 18uGpgtBTFlFhvt7VXh2S/rdsl+0dAEP/8mQX89oZxOOwYTFl/IDbaV4DYV8diFX WLy6vyjI82/l/1mvI2KviOEPvZLkWZ35Lr3l2Z7ZOMO/MVApDwlajgO1Bemu4n5B NRGYMCbsMjOBu21hbvGqaFco6yzaUWG7/Ch2CiWFndw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=NYZrb1 LXZVTVb4+x3yY6JN2WDZ6gbGbPORE0ET1zdug=; b=S9fYdHufrkRU58vJtMyv6x EEGih08iD8NT9GSrkVfcRsarK7ts/89doSm3HrNtYGeBZniBKofLTNOxRLW/J8w0 cCn3/UlpXQbQUrLHskblRCATvEW8giHzme9KrvXyjx5QZBDB6hqX5JA+HZcsCfmw 9/ep1HJ0KdOAH5JE4j3vr7KevydJ81Bp4ejVl/xjB1gpRzcRAGj7e3tbKz3YAU82 4ci+SjnHWimKcoFvVPaZ8jMdaJgnf0qnoN1ju2R7R7kkHAJ2s725ouLUM0AMJl2z h30vdw0nqgcUVNzVbuukIUAOtM1heEREFgCrk7IjOKH4oizUh7a5AaEo2IezYSzA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrfedugdekheculddtuddrgedtkedrtddtmd cutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthen uceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvuffkfhggtggujgesthdtre dttddtvdenucfhrhhomheptehnughrvghsucfhrhgvuhhnugcuoegrnhgurhgvshesrghn rghrrgiivghlrdguvgeqnecukfhppeelkedrvddutddrudegtddrudejudenucfrrghrrg hmpehmrghilhhfrhhomheprghnughrvghssegrnhgrrhgriigvlhdruggvnecuvehluhhs thgvrhfuihiivgeptd X-ME-Proxy: Received: from intern.anarazel.de (c-98-210-140-171.hsd1.ca.comcast.net [98.210.140.171]) by mail.messagingengine.com (Postfix) with ESMTPA id CB4FD1026D; Wed, 9 Jan 2019 11:07:29 -0500 (EST) Date: Wed, 9 Jan 2019 08:07:28 -0800 From: Andres Freund To: ap@zip.com.au, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #15582: ALTER TABLE/INDEX ... SET TABLESPACE does not free disk space Message-ID: <20190109160728.cmcnkf4x2hnqb4lr@alap3.anarazel.de> References: <15582-dae8ba537137883d@postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <15582-dae8ba537137883d@postgresql.org> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, On 2019-01-09 02:21:48 +0000, PG Bug reporting form wrote: > I've added a tablespace recently to help deal with almost running out of > disk space. > > I then tried to use it with: > > ALTER TABLE schema.table SET TABLESPACE hydro2_tmp; > > This worked in so far as disk space was used on hydro2_tmp but nothing was > ever freed in the default location. > > I tried a VACUUM FULL but that did not help. > > Then I tried moving the indexes belonging to the table but that also did not > help. > > Everywhere I've read and everyone I spoke to said that this is a move > operation but it appears to be a copy so, unless I missed something, this > appears to be a bug. > > The two table spaces are on separate drives and postgres is from postgres' > apt repository. If you restart postgres, is the space freed? I suspect the issue is that we don't properly close the old relation in all backends that had it open, but it's hard to know for sure without that. If restarting isn't feasible, ensuring all backends older than the move are ended, and issuing a CHECKPOINT; might also free the space after a few seconds. Greetings, Andres Freund