Re: releasing space

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: releasing space
Дата
Msg-id c11edad5-bd4e-7f57-4cbc-d0f2ba02f037@aklaver.com
обсуждение исходный текст
Ответ на releasing space  (Julie Nishimura <juliezain@hotmail.com>)
Список pgsql-general
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



В списке pgsql-general по дате отправления:

Предыдущее
От: Michael Lewis
Дата:
Сообщение: Re: Vacuum very big table - how the full vacuum works in background/internally?
Следующее
От: PegoraroF10
Дата:
Сообщение: Re: Changing PK on replicated database