Automatic vacuum is the automatic execution of VACUUM periodically using the job scheduling function of the OS such as cron.
Although automatic vacuuming is a convenient function, it is recommended to run VACUUM manually, for system operations.
To execute vacuum manually, execute the vacuumdb command from the OS command line, or connect to the database and execute the VACUUM command.
※This sample exam is different from those that appear in the actual OSS-DB Exam.
The data structure of PostgreSQL is a write-once type. Even if you DELETE the data, the data is not removed, instead a delete mark is set against it. Since UPDATE executes DELETE + INSERT, the space used increases. VACUUM is a mechanism for collecting deleted space and enabling reuse. Since reclaimed space will be used during the next INSERT, if you run VACUUM, then the size of the data file will not increase immediately. Although VACUUM does not reduce the size of data files, executing VACUUM FULL does reduce the file size because it rewrites the data file without the gaps from where data was deleted. However, VACUUM FULL has side effects such as obtaining a table lock, so its execution is not recommended.
Although it is necessary to periodically execute VACUUM during system operation management, autovacuum is enabled by default in the current version of PostgreSQL, and it is recommended to be used. In automatic vacuum, VACUUM is automatically executed when the update amount exceeds a certain threshold value for each table. The threshold is set to an appropriate value by default, but it can be customized for each table if necessary.
To execute VACUUM manually, execute the vacuumdb command from the OS command line, or connect to the database with psql and execute the VACUUM command.
Therefore, the correct answer is E.