From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Julie Nishimura <juliezain@hotmail.com>
To: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
To: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: releasing space
Date: Thu, 17 Oct 2019 11:34:05 -0700
Message-ID: <c11edad5-bd4e-7f57-4cbc-d0f2ba02f037@aklaver.com> (raw)
In-Reply-To: <BYAPR08MB501443550E05D3410E1CA03EAC6D0@BYAPR08MB5014.namprd08.prod.outlook.com>
References: <BYAPR08MB501443550E05D3410E1CA03EAC6D0@BYAPR08MB5014.namprd08.prod.outlook.com>
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=f47...
Start at line 767
>
> Thank you!
>
> -Julie
--
Adrian Klaver
adrian.klaver@aklaver.com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: adrian.klaver@aklaver.com, juliezain@hotmail.com
Subject: Re: releasing space
In-Reply-To: <c11edad5-bd4e-7f57-4cbc-d0f2ba02f037@aklaver.com>
References: <BYAPR08MB501443550E05D3410E1CA03EAC6D0@BYAPR08MB5014.namprd08.prod.outlook.com> <c11edad5-bd4e-7f57-4cbc-d0f2ba02f037@aklaver.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox