Sample Exam Questions

From the objective of OSS-DB Exam Silver
- Operation management - basic operation management work

Sample Question

1.49

Choose the correct statement about the VACUUM function

  1. Since VACUUM does not reduce the size of the data file, it is recommended to periodically execute VACUUM FULL, which makes the data file smaller to save disk space.
  2. Automatic vacuum is the automatic execution of VACUUM periodically using the job scheduling function of the OS such as cron.

  3. Automatic vacuum  automatically executes VACUUM when the load on the system is small.
  4.  Although automatic vacuuming is a convenient function, it is recommended to run VACUUM manually, for system operations.

  5. 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.
2019/05/30

Answer and Explanation

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.