
This is a regular “data quiz”. Follow it on LinkedIn. Test your knowledge or learn something new.
Today Question:
In PostgreSQL, the VACUUM command is used to:
A) Data compression
B) Removing dead rows
C) Reindexing
D) Update
Correct Answer: B
Explanation
The VACUUM command in PostgreSQL is used for database maintenance by removing dead rows created during UPDATE and DELETE operations. PostgreSQL uses MVCC (Multiversion Concurrency Control), which means each transaction sees its own version of data and old versions are not removed immediately. If these dead rows were not cleaned up, the database would grow continuously and query performance would degrade. VACUUM also frees disk space, makes it reusable, and updates internal statistics for the query optimizer, which can improve query planning. There is a standard VACUUM that only cleans dead rows, and VACUUM FULL, which rewrites entire tables and can significantly reduce physical database size but is more demanding on performance and table locking. Proper and regular use of VACUUM is essential for stability and performance of PostgreSQL databases, especially for large and frequently updated tables.
