VACUUM
(or VACUUM FULL
) is hardly useful in this case, since it only reclaims space from within tables.
Well, there are entries in catalog tables that would leave dead tuples behind after dropping a table. So the database can occupy slightly more space after a table has been created and dropped again.
To get a db down to minimum size again, run the client tool vacuumdb
with the --full
option:
vacuumdb -f mydb
On Postgres 9.0 or later, this also rewrites indices in prestine condition. Details in the Postgres Wiki:
http://wiki.postgresql.org/wiki/VACUUM_FULL
That's how Postgres measures db size: with dedicated object size functions:
SELECT pg_size_pretty(pg_database_size(mydb));