Senior
What is the difference between VACUUM and VACUUM FULL?
sobes.tech AI
Answer from AI
VACUUM and VACUUM FULL are commands in PostgreSQL for cleaning the database from "dead" rows that remain after updates and deletions.
-
VACUUM: performs a regular cleanup, freeing space for reuse within the table, but does not reduce the physical size of the table file. It is a quick process that does not lock the table for reading and writing.
-
VACUUM FULL: performs a more thorough cleanup, compressing the table and releasing unused space back to the operating system. During this operation, the table is locked for reading and writing, and the process takes significantly longer.
In summary:
- Use
VACUUMfor regular maintenance without locks. - Use
VACUUM FULLwhen you need to reclaim disk space, for example, after mass data deletion.