Sample Exam Questions

From the objective of OSS-DB Exam Silver
S2.5 Basic server administration (Starting and stopping PostgreSQL)

Sample Question


Choose two appropriate descriptions for a command to stop a database:
pg_ctl stop -m fast

  1. It waits for a connected client session, if any, to terminate.

  2. For running transactions, commit is performed automatically.

  3. For running transactions, rollback is performed automatically.

  4. Recovery occurs on reboot.

  5. Since PostgreSQL version 9.5, this mode is the default, so the behavior is the same without “-m fast.”

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

Answer and Explanation

To stop the PostgreSQL server, use the 'pg_ctl stop' command. If you installed the package on Linux, you would use the service or systemctl commands, but the pg_ctl command would be issued internally.
When you shut down a database, there are three modes for how connected clients and running transactions are handled, which you specify with the -m option.

If '-m smart' is specified, the system waits for all clients to terminate their connections before stopping. This was the default up to PostgreSQL version 9.4.

'-m fast' forces all client connections to be terminated and automatically rolls back any active transactions before shutting down the database. This is the default in PostgreSQL versions 9.5 and later.
'-m immediate' stops all database processes immediately without any cleanup. In this case, the database is restored to a healthy state by automatically performing a recovery operation on the next boot.

So the correct answers are C and E.