Sample Exam Questions

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

Sample Question

1.46

Choose two descriptions that are true about ANALYZE.

  1. To ANALYZE the entire database, execute the pg_analyze command from the OS command line.
  2. To ANALYZE the table foo, connect to the database and execute the following command.ALTER TABLE foo ANALYZE;

  3. You can ANALYZE the entire database by executing the vacuumdb command from the OS command line.
  4.  ANALYZE examines what data is contained in the table.

  5. ANALYZE examines the access frequency information such as how many times the table was SELECTed and how many times it was updated.

※This sample exam is different from those that appear in the actual OSS-DB Exam.
2019/05/30

Answer and Explanation

To optimize the planning of queries against the database,  ANALYZE parses the content of  tables to provide statistics. For example, it checks what values ​​are in a particular column of the table, how scattered a value is, how much data is NULL, which helps determine whether to use an index or do a full search. It is also used as a reference when deciding upon plans, such as which table to scan first when joining tables, what algorithm to use in join. Since table access frequency is not related to planning, it is not collected by ANALYZE.

To execute ANALYZE, connect to the database with psql and execute the ANALYZE command.

ANALYZE table_name;

By doing so, you can only ANALYZE the specified table, but if you do not specify the table name, all the tables in the database to be connected will be ANALYZEED. Also,

VACUUM ANALYZE;

It is also possible to perform ANALYZE simultaneously with the execution of vacuum.

This is helpful when deciding plans such as which index to use, whether to search all entries, which table to scan first when joining tables, and what algorithms to use in joins when a query is executed.

Since table access frequency is not related to planning, it is not collected by ANALYZE.

To execute ANALYZE, connect to the database with psql and execute the ANALYZE command.

Executing the vacuumdb command from the OS command line with -z or --analyze option is equivalent to VACUUM ANALYZE.

Also, if you use -Z or --analyze-only option, you can execute only ANALYZE without executing VACUUM.

There is no command called pg_analyze, it can not be ANALYZE by ALTER TABLE.

 

Therefore, the correct answers are C and D.