Search This Blog

Saturday, April 25, 2009

Vacuum a Database???


Here is an interesting concept true for PostgreSQL.
In Postgres, whenever a row is updated, the updated row creates a new version for the current transaction. The old version is not deleted. Is a similar way there are many tuples in the database which are not physically removed, due to Updates/Inserts.

Postgres's feature of Vacuum
reclaims storage occupied by the deleted tuples.
A flavor of Vacuum, "VACUUM ANALYZE" also helps analyze the database.

It is necessary in Postgres to vacuum frequently updated table for a better performance.

Question: Why does Vauum create these different versions of the rows in the first place??
Answer: I am still trying to find the exact description behind using MVCC. So more... Coming soon...

No comments: