I drooped couple of tables from 'postgres' database. However before dropping tables size of the database was 6586kB and after dropping the tables size of the database remains same. I think size should be reduced. What I need to do to get the actual size. I know about VACUUM command. Do I need to use that? and how?
|
6586KB is about the size of an "empty" (freshly created) database. If the tables you dropped were very small or empty, dropping them will not reduce the size by much if any. When I drop a populated large table, the reduction in database size (as seen by psql's "\l+" command) is reflected near instantaneously, with no need for a vacuum or a checkpoint. |
|||||||||
|
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
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:
|
|||
|
Use truncate, understand the warning about MVCC first
|
|||
|