Freeing disk space used by the database

In exceptional circumstances you may want to reduce the size of the database files created by the database system. Normally this is not recommended, as it reduces performance and can increase disk fragmentation, but if you are running short of disk space and have made a setting change which will lead to a reduction in the amount of data being stored (such as decreasing the time for which historical logging records are kept) then it may be something you wish to do.

Usually the best way of freeing disk space is to do a database backup & restore. This requires VPOP3 to be stopped while it is performed.


Steps for backup/restore

(These instructions are for VPOP3 v5 or later)

  • Stop the VPOP3 service, not the VPOP3DB service

  • Go to a command prompt in the VPOP3 directory

  • Backup the database to a file, eg 'database.dmp', using, eg: pgsql\bin\pg_dump -p 5433 -v -F c -U postgres -f database.dmp vpop3

  • Remove the old database using pgsql\bin\dropdb -U postgres -p 5433 vpop3

  • Restore the database backup using, eg: pgsql\bin\pg_restore -v -j 4 -U postgres -p 5433 -C -d postgres database.dmp

  • Restart the VPOP3 service

If asked for a password, the default password to use is pgsqlpass

For further information, see the PostgreSQL documentation: