Thread: How to shrink database in postgresql

How to shrink database in postgresql

From
Rehan Saleem
Date:
hi ,
how can i shrink database in postgresql here is a MS-SQL store procedure which shrinks the database. how same task can be achieved in postgresql.

ALTER PROCEDURE [dbo].[sp_CleanUpDB]
AS
declare @db nvarchar(50)
select @db = db_name()
DBCC SHRINKDATABASE (@db, 10)

thanks

Re: How to shrink database in postgresql

From
Pavel Stehule
Date:
Hello

the most similar tool in pg is "VACUUM FULL" statemet;

Regards

Pavel Stehule

2012/2/29 Rehan Saleem <pk_rehan@yahoo.com>:
> hi ,
> how can i shrink database in postgresql here is a MS-SQL store procedure
> which shrinks the database. how same task can be achieved in postgresql.
>
> ALTER PROCEDURE [dbo].[sp_CleanUpDB]
> AS
> declare @db nvarchar(50)
> select @db = db_name()
> DBCC SHRINKDATABASE (@db, 10)
>
> thanks
>


Re: How to shrink database in postgresql

From
Mario Marín
Date:
2012/2/29 Pavel Stehule <pavel.stehule@gmail.com>:
> Hello
>
> the most similar tool in pg is "VACUUM FULL" statemet;

Hello,

From: http://wiki.postgresql.org/wiki/VACUUM_FULL "Many people, either
based on misguided advice on the 'net or on the assumption that it
must be "better", periodically run VACUUM FULL on their tables. This
is generally a really bad idea and can make your database slower not
faster",  it is better to use  autovacuum. Please read the wiki,
you'll find all the information you need.

Regards,

Mario Marín