9.1.1.1 Freeing System Disk Space

This section describes freeing up system disk space after deleted tiles (or other records).

To see how much space is begin used by the whole database:

SELECT pg_size_pretty(pg_database_size('trip'));

To see how much space is being used the the tiles table:

SELECT pg_size_pretty(pg_table_size('tile'));

Normally, a PostgreSQL installation will be configured to run the VACUUM command automatically from time-to-time. This allows deleted records to be re-used, but does not generally free up the system disk space being used by the deleted records. To do that, the VACUUM command needs to be run with the FULL option.

Note that VACUUM FULL requires an exclusive lock on the table it is working on so cannot be run in parallel with other database operations using the table.

See the Recovering Disk Space section of the PostgreSQL documentation for more information.

To free up the system disk space used by the tiles table, in plsql run:

VACUUM FULL tile;

or

VACUUM (FULL, VERBOSE) tile;

To free up the system disk space used by all tables:

VACUUM FULL;

or

VACUUM (FULL, VERBOSE);