Sample Exam Questions

From the objective of OSS-DB Exam Gold
- Performance Tuning - Parameters related to performance

Sample Question

3.06

Before and after changing the GUC parameter enable_seqscan from ""on"" to ""off"", execution plans are obtained for the same query using EXPLAIN ANALYZE.
Choose the one statement that is the least accurate as a description of the change in the execution plan.
Assume all conditions other than enable_seqscan are the same.

  1. The "Total runtime" value may increase.

  2. The "Total runtime" value may decrease.

  3. The total estimated cost of the top node may increase.

  4. The total estimated cost of the top node may decrease.

  5. The exact same execution plan may be selected.

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

Answer and Explanation

[Option A]
The "Total runtime" shown by EXPLAIN ANALYZE represents the elapsed time for the entire query execution. Turning off enable_seqscan can increase the total runtime if the query planner chooses a less efficient method than a sequential scan for queries that would benefit from it.
Therefore, A is accurate.

[Option B]
Disabling enable_seqscan might reduce the total runtime if the planner incorrectly chose a sequential scan due to inaccurate statistics. In this case, by turning enable_seqscan off, other efficient methods may be used.
Therefore, B is accurate.

[Option C]
If a sequential scan is absolutely necessary for a certain query, sequential scan will be selected even with enable_seqscan set to "off". In this case, the planner assigns 100000000000000 as a cost for the sequential scan, resulting in a significantly higher total estimated cost.
Therefore, C is accurate.

[Option D]
Changing enable_seqscan from "on" to "off" increases the cost associated with sequential scans; it doesn't decrease any other costs. Therefore, an execution plan with a lower total estimated cost is unlikely. As mentioned in option B, turning enable_seqscan off can reduce the total runtime, but the estimated cost will likely be higher. (If the total estimated cost were lower, that plan would have been chosen before disabling enable_seqscan.)
Therefore, D is not accurate.

[Option E]
If a query doesn't use a sequential scan even when enable_seqscan is set to "on", turning it off may result in the same execution plan.
Therefore, E is accurate.

The correct answer is D.