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 1iLAbJ-0000pL-Ca for pgsql-general@arkaria.postgresql.org; Thu, 17 Oct 2019 18:34:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iLAbH-00045O-H9 for pgsql-general@arkaria.postgresql.org; Thu, 17 Oct 2019 18:34:15 +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 1iLAbF-000457-KH for pgsql-general@lists.postgresql.org; Thu, 17 Oct 2019 18:34:15 +0000 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iLAbB-0002UD-MD for pgsql-general@lists.postgresql.org; Thu, 17 Oct 2019 18:34:12 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id F1C42420; Thu, 17 Oct 2019 14:34:07 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Thu, 17 Oct 2019 14:34:08 -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=fm1; bh=W wJHED0nlHwyUfs43m+PYi5e/0UGLY9sGn7/xFZO3bM=; b=k1eg/BRmZcLODNIyi IF1E3jj0Y4YI5VNopJDecIDoRRvK842IOuI7+Iq4OGZgBHsh9gTq5spDuUCV+bvb y1Gl+BJeHEELfDYvsVwPZqdADuKshfBogcGSFjx9i+AdfeWq21KO7lx1spP0QPiR cIzmSUFV1DYt28mydOx+kCz5MPrFSwBe6vQtjdmjhWIdyIFL4vhBmnmfLpLYyFr2 oakX3j3delQB9RkywrdQAwSKsKBF/cC7WupuoBRgbnPCLsAN7daNs0p5EOGBU/HT hCcvZYK7N9h6YLZwwdtXS/Ekwc5yhtJe44pVn0vnD3TNJn0fu/owrIcbIqdPMJWs eGyDQ== 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=fm1; bh=WwJHED0nlHwyUfs43m+PYi5e/0UGLY9sGn7/xFZO3 bM=; b=luT5LZ1V0chQoKitdbuyjS7AIIc0n3Yn3kzcqrAKGea6UrnQzyjc0MzfZ 44qBJ31GkqbqiStcV1KiS6wcKYJBXYhyst83oUh9+9yRK49YtoABg96SXMkNBxCc uV96nVo29rW+zSmqk2QEF00Ib56SE94PzK6Vz0brXac5EaSboaAR9UueEIcbFlcu /TqMpg83zKZgG4MOeVf9UyOhB1myKasJqMMpbOw65rrouFNPlMyxlzYqFzuQHklr RwIR6uaXxi8D2YxCSNZVze+kiHaojiNC8WsfLCSHO1mIr3+yvqMU9f8WjcNJl5l0 0sPKC5R2aectZVAc2zD/cnQXS8bGA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrjeejgdduvdeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefuvfhfhffkffgfgggjtgfgsehtke ertddtfeehnecuhfhrohhmpeetughrihgrnhcumfhlrghvvghruceorggurhhirghnrdhk lhgrvhgvrhesrghklhgrvhgvrhdrtghomheqnecuffhomhgrihhnpehpohhsthhgrhgvsh hqlhdrohhrghenucfkphephedtrdduleefrdduleeirddutdeinecurfgrrhgrmhepmhgr ihhlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhmnecuve hluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from ranger.suse (50-193-196-106-static.hfc.comcastbusiness.net [50.193.196.106]) by mail.messagingengine.com (Postfix) with ESMTPA id 8C9CED6005A; Thu, 17 Oct 2019 14:34:06 -0400 (EDT) Subject: Re: releasing space To: Julie Nishimura , "pgsql-general@lists.postgresql.org" , pgsql-general References: From: Adrian Klaver Message-ID: Date: Thu, 17 Oct 2019 11:34:05 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 10/17/19 10:20 AM, Julie Nishimura wrote: > Hello everybody, > We are running PostgreSQL 9.6.2 cluster master -> standby (streaming > replication). 22 tb of space (constantly struggling with the space, > pruning the old data, but not fast enough). The biggest db takes 16 tb. > So, we've copied it to another server, and now we would like to delete > it from our original source, to free up the space. What would be the > right approach for this?  Just issue drop database command (16tb). How > long it might take? Should we do it gradually (drop biggest tables > first)? Any suggestions? Caveats? https://www.postgresql.org/docs/11/sql-dropdatabase.html "DROP DATABASE drops a database. It removes the catalog entries for the database and deletes the directory containing the data. It can only be executed by the database owner. Also, it cannot be executed while you or anyone else are connected to the target database. (Connect to postgres or any other database to issue this command.) ... DROP DATABASE cannot be undone. Use it with care!" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Means there is no transaction involved unlike DROP TABLE, so I would say it is quicker. If you want to see all that is involved: https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/backend/commands/dbcommands.c;h=f47a13d1844ca36d81ba9815f807646a44750de4;hb=86ca7f81f7dfc17f04698189dec8973d358bc711 Start at line 767 > > Thank you! > > -Julie -- Adrian Klaver adrian.klaver@aklaver.com