Junior — Middle
Explain the concept of full vacuum cleaning in a database and its features.
sobes.tech AI
Answer from AI
Full vacuum in a database is a process during which all unused data is removed and space occupied by deleted or updated rows is freed. In systems with MVCC (multi-version concurrency control), such as PostgreSQL, old versions of rows remain in the table until a vacuum cleanup is performed.
Features of full vacuum:
- It completely frees disk space, reducing the size of tables and indexes.
- It may lock the table during execution, affecting availability.
- Unlike incremental vacuum, full vacuum performs reindexing and compression of the table.
- It is used to recover space after large deletions or updates.
Example in PostgreSQL:
VACUUM FULL my_table;
This command will fully clean the my_table, freeing space and reducing the file size on disk.