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 1hQHH8-0002lu-Pf for pgsql-general@arkaria.postgresql.org; Mon, 13 May 2019 20:10:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hQHH7-00017c-Ho for pgsql-general@arkaria.postgresql.org; Mon, 13 May 2019 20:10:17 +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 1hQHH6-00014n-9L for pgsql-general@lists.postgresql.org; Mon, 13 May 2019 20:10:17 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hQHH3-0007L1-72 for pgsql-general@lists.postgresql.org; Mon, 13 May 2019 20:10:15 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 563F0243F3; Mon, 13 May 2019 16:10:12 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Mon, 13 May 2019 16:10:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm2; bh=J dPjnCChcsTE6MCOt/CaoUs+R5ioZDXWkyaPm2RXF44=; b=sDdcspKenzMZXUpW4 rzi4CJKvJtEok3l7zuETUy4RJjxvr7rzmhYTiX5vc0Vv85dr0paf0AAvOKZFY1DG el7Myl81s2E4ve1c9yEBzqaJBG1ynVVa2F7A+o/nwvBwGQSNyoI5RezdKFc2kcmU ZpNiQfjiKq5xiIfWhZpKywCdC0fh+q96Qdf7MXvH9BZqZ0VCgpCfu4pdjr6y4Eb7 0V5laehdx1ghm2Z5zk0JMqz6kIx3fNt/OPLZHoeF9alrXlwHLeU9khbeTrTVOP/Y vwIT1L3G8pv/HAK1Z9NIOCpko/ELf6IU6r5qk5k+Wz7H3hOgm0c1xUxU8igIOol+ C+xHA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding: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=fm2; bh=JdPjnCChcsTE6MCOt/CaoUs+R5ioZDXWkyaPm2RXF 44=; b=YErNAf8bBLai2E6dY+Ar8RotWmaFSqjOmb6gKBfWcBIV4nlIX/V86SpHa 2uyxsj/UqA+IYcX3rkSTszyJ+8P5EeOmY4eXc1aDHW6yr6Fl+kOq6FjhCM/ekgzG U0bn0ez+Zw/fRIkl6u/rWwgkuYjX8VSR0NiGI/bLyMkBCKmG8vAZm+nJ910f/84y 9VunC5vS7sMz9urlstZxMTxwPsZxnY5Z3WT7KyfFaiXDjFMKFpobiw6ze7Abetvq jsNX4Ssmoy8BbGhPBZvhbla7w81cNhhXFtIK8FSoqaldBI/nEPDUMCuFfrykFJJ0 5FPd3/2T4yevToM5YrzfrYeqbNxFg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduuddrleeggddugeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefuvfhfhffkffgfgggjtgfgsehtje ertddtfeehnecuhfhrohhmpeetughrihgrnhcumfhlrghvvghruceorggurhhirghnrdhk lhgrvhgvrhesrghklhgrvhgvrhdrtghomheqnecuffhomhgrihhnpehpohhsthhgrhgvsh hqlhdrohhrghenucfkphepjedurddvuddvrdduhedtrddvtddvnecurfgrrhgrmhepmhgr ihhlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhmnecuve hluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from [192.168.1.4] (unknown [71.212.150.202]) by mail.messagingengine.com (Postfix) with ESMTPA id F1ABD8005A; Mon, 13 May 2019 16:10:10 -0400 (EDT) Subject: Re: does postgresql backup require additional space on disk To: Julie Nishimura , "pgsql-general@lists.postgresql.org" , pgsql-general References: From: Adrian Klaver Message-ID: <86c77c15-c089-a7fb-53d8-a6c14c9cd28a@aklaver.com> Date: Mon, 13 May 2019 13:10:10 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 5/13/19 12:33 PM, Julie Nishimura wrote: > We have added new disk volume and about to introduce new tablespace > using this additional disk space. After that, I am going to alter all > user dbs (and template db as well) by runnig the following command: Not sure why you need to move the template db's they sure not take much space? More comments below. > > CREATE TABLESPACE vol4 > OWNER postgres > LOCATION '/data/vol4'; > > ALTER DATABASE user_db_1 > SET default_tablespace = 'vol4'; > > ...for all dbs.. > > We have more than 70 different databases (the entire server is about 20 > tb). However, for the largest dbs (16tb, 4 tb, and 3 tb), we do not have > valid backups, unfortunately. So, we were debating if we need to run > backups first before introducing all these changes. But we have only 1% > left (about 200 gb). I have no experience with a setup of this size, someone else will have to provide real world advice. I would say taking a backup before preceding is a good idea. Pretty sure time is going to be as much an issue as space. This would apply to below also. The question is what options you have to bring cluster or databases down? In particular for below as: https://www.postgresql.org/docs/11/sql-alterdatabase.html "The fourth form changes the default tablespace of the database. Only the database owner or a superuser can do this; you must also have create privilege for the new tablespace. This command physically moves any tables or indexes in the database's old default tablespace to the new tablespace. The new default tablespace must be empty for this database, and no one can be connected to the database. Tables and indexes in non-default tablespaces are unaffected." > > What would you suggest? How would you classify the risk of this > operation (creating new tablespace and altering dbs to use it)? > > Thanks, > Julie > > ------------------------------------------------------------------------ > *From:* Adrian Klaver > *Sent:* Monday, May 13, 2019 11:19 AM > *To:* Julie Nishimura; pgsql-general@lists.postgresql.org; pgsql-general > *Subject:* Re: does postgresql backup require additional space on disk > On 5/13/19 10:59 AM, Julie Nishimura wrote: >> Hello, >> we are almost out of disk space on one of our servers (99% full). If we >> run pg_dump to a diff location, does it require any additional disk >> space on our current server? I am asking, because on some other >> software, a backup might open transaction which keeps growing and >> eventually consume all space, keeping tran open for the backup duration. >> Please clarify? Thanks > > A pg_dump is a point in time snapshot of the database, so if the cluster > is running then it will advance past the dump snapshot. If the cluster > is not active(close off connections to all but pg_dump) then pg_dump > will be the only transaction. > > I think the first thing to ask is what you are trying to achieve? > > -- > Adrian Klaver > adrian.klaver@aklaver.com -- Adrian Klaver adrian.klaver@aklaver.com