After actual execution of the query, you notice that the hash join was done in the execution plan: Identify the reason why the optimizer chose different execution plans.

Examine the parameter for your database instance:

You generated the execution plan for the following query in the plan table and noticed that the
nested loop join was done. After actual execution of the query, you notice that the hash join was
done in the execution plan:

Identify the reason why the optimizer chose different execution plans.

Examine the parameter for your database instance:

You generated the execution plan for the following query in the plan table and noticed that the
nested loop join was done. After actual execution of the query, you notice that the hash join was
done in the execution plan:

Identify the reason why the optimizer chose different execution plans.

A.
The optimizer used a dynamic plan for the query.

B.
The optimizer chose different plans because automatic dynamic sampling was enabled.

C.
The optimizer used re-optimization cardinality feedback for the query.

D.
The optimizer chose different plan because extended statistics were created for the columns
used.

Explanation:
* optimizer_dynamic_sampling
OPTIMIZER_DYNAMIC_SAMPLING controls both when the database gathers dynamic statistics,

and the size of the sample that the optimizer uses to gather the statistics.
Range of values0 to 11



Leave a Reply 11

Your email address will not be published. Required fields are marked *


Amar

Amar

Answer is A. C is not the correct answer since during re-optimization query uses the correct cardinality and hence a changed execution plan on the second run of the sql, wheras in Dynamic plan option the plan is changed during the first execution itself.

Morilla

Morilla

OPTIMIZER_ADAPTIVE_REPORTING_ONLY – Controls the reporting mode for automatic reoptimization and adaptive plans (see “Adaptive Plans”). By default, reporting mode is off (false), which means that “adaptive optimizations are enabled”

B is wrong – must be 11 to be enabled.

picoman

picoman

c

2.2.4.1 Adaptive Query Optimization

It is possible for the optimizer to miscalculate some estimations during initial plan generation. Adaptive query optimization allows these miscalculations to be corrected in one of the following two ways:

With adaptive plans, a plan can be stopped during execution and reoptimized based on information collected during the initial part of the execution. For example, if the initial plan choice was to do a NESTED LOOP with an estimated cardinality of 1, that plan is stopped after 1,000 records have been sent to the join and restarted using a HASH JOIN instead because the initial cardinality estimate was wrong.

Automatic reoptimization does not affect the initial execution of a statement. Instead, the initial execution of a query is monitored and, if the actual execution statistics vary significantly from the original plan estimates, the execution statistics are recorded and used the next time the statement is executed to see if a new plan is chosen for subsequent execution.

domq

domq

I also think that correct answer is A, because dynamic plan can change execution plan during execution of a stmt.
Re-optimization change plan after stmt execute with wrong cardinality in secnd run.

Answer B is definetly wrong beacuse new dynamic_plan parameter is 11.

elcid

elcid

True! A is correct !
The two Adaptive Plan techniques are:
• Dynamic plans: A dynamic plan chooses among subplans during statement execution.
For dynamic plans, the optimizer must decide which subplans to include in a dynamic
plan, which statistics to collect to choose a subplan, and thresholds for this choice.
• Re-optimization: In contrast, reoptimization changes a plan for executions after the
current execution. For re-optimization, the optimizer must decide which statistics to
collect at which points in a plan and when re-optimization is feasible.

narendra

narendra

A – Is the Correct Answer

Amit

Amit

C – is the correct answer