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 1iLo62-0004bQ-KI for pgsql-general@arkaria.postgresql.org; Sat, 19 Oct 2019 12:44:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iLo61-0001EE-A6 for pgsql-general@arkaria.postgresql.org; Sat, 19 Oct 2019 12:44:37 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1iLo60-0001B5-Up for pgsql-general@lists.postgresql.org; Sat, 19 Oct 2019 12:44:36 +0000 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iLo5x-0004QU-9m for pgsql-general@lists.postgresql.org; Sat, 19 Oct 2019 12:44:36 +0000 Received: by mail-wr1-x444.google.com with SMTP id p4so8938193wrm.8 for ; Sat, 19 Oct 2019 05:44:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=T1ZdhDtNcOhFaSUulntFfWHXIuz++ryepcWaBK7GZFw=; b=rnr38OsqbSanW/XaEYodzh1Ho2IGvrIO3yDGMOovxAIHVEKDmRh4Mk5YSr/9ZqD/Dq LwW/GivTgR1u+bGN3r1uhU8ks604Md4aiM1O3JlV0SQ6z1sWMQ0eJAaPMEgZoejiLpS3 6MIIPERxUdH1ydz8mqFrJ5ZBbQ1CvaFEW5pqT2bJEvKEcGl1v1lnwwZ1r26yKHaoFRjL RsgsKgrnZPo23sz1fwG87fcMjxgGcCkh6Pv6gH4A9XXfacFcNDdQPVdwRGX6ZMDWIjjY 3zS8XUdxLp3INe68WISrIGUV85aQgHa7E0yRL0YXbx6dDbLOvMr7YCw1s3f7yxFfeXYh Yttg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=T1ZdhDtNcOhFaSUulntFfWHXIuz++ryepcWaBK7GZFw=; b=TtcrAymYLF1wuYUq3cZvxcaJRBG26I0Fe3P+qsqpPBXDDk7jX39DNJ4hIi9os/FsST d8gY1vYh4N5P0eGy3Ri5y4Wpw8dvd0Hlr8cnszeE2SorB1Iy7ap0xtSjwTz8a9R56OmD Qv9tS/xBq5/EQV5Xu5oWOCpAQO0zF9/NiDEMvqftIriV2brKfY1CAS8w2dxB/mhWOH3+ iD0gqmstP9LvWBjya9gxA1Iwl+p2KjDKoPWOEDC6MLed22cu8aUuOhf7bSuCyF6Pwh/L K4Z2LLXsXdDamE0ot5W2w180Vx0yp1X1T9CLOmPNN9SvRyeJ3RSeWw1l+FrNKsszgSx+ NWfw== X-Gm-Message-State: APjAAAWRrOMAZNsCNCK2ntMwWXnbTPMRlWeM9Aq+hPkaoNHEmm6W3YsT lv587ZCUUg2TN0YleftaD/Dwig== X-Google-Smtp-Source: APXvYqy9W/z8br+WBG+tHp/039n7cVMGDSNmgHU/Gf2RHlWQDylfL4PC+TXEeksmxAPXE5d0aOSA7Q== X-Received: by 2002:a5d:4aca:: with SMTP id y10mr11562373wrs.292.1571489072479; Sat, 19 Oct 2019 05:44:32 -0700 (PDT) Received: from localhost (cst-prg-73-11.cust.vodafone.cz. [46.135.73.11]) by smtp.gmail.com with ESMTPSA id o6sm247596wrx.89.2019.10.19.05.44.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Oct 2019 05:44:31 -0700 (PDT) Date: Sat, 19 Oct 2019 14:44:29 +0200 From: Tomas Vondra To: Julie Nishimura Cc: "pgsql-general@lists.postgresql.org" , pgsql-general Subject: Re: releasing space Message-ID: <20191019124429.6htvmc7rhoc2m4hs@development> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Thu, Oct 17, 2019 at 05:20:09PM +0000, 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? > Generally speaking, DROP DATABASE simply recursively drops all the various objects - indexes, tables, etc. It mostly just deleting the files, which should not be very expensive (we certainly don't need to delete all the data or anything), but there's certain number of I/O involved. But it does depend on the OS / filesystem / hardware if that's an issue. So if you want to be on the safe side, you can drop the objects one by one, with a bit of delay between them, to throttle the I/O a bit. FWIW the latest minor release for 9.6 is 9.6.15, you're 13 minor versions (~30 months) of fixes behind. You might want to consider upgrading ... -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services