ALL_ROWS : The
optimizer will attempt to find an execution plan that completes the statement
(typically meaning “returns all the rows”) in the shortest possible time. There
are no special constraints built into this code. Used typically in OLAP
Systems.
FIRST_ROWS_N (N
=> 1, 10,100,1000) The optimizer first estimates the number of rows that
will be returned by completely analyzing just the first join order. This tells
it what fraction of the total data set the query is supposed to fetch, and it
restarts the entire optimization process with the target of finding the
execution plan that minimizes the resources required to return that fraction of
the total data. This option was introduced in 9i. Used typically in OLTP
systems.
FIRST_ROWS: Deprecated in 9i, but maintained for backward
compatibility. The optimizer will attempt to find an execution plan to return
the first row of a result set as rapidly as possible. There are several
high-level constraints built into the code.
There
are two other options for the optimizer_mode
(even in 10g): rule and choose (default).
Up to
Oracle9i, the default value is choose.
This means that if object statistics are available for at least one of the
objects referenced in the SQL statement that has to be optimized, the value all_rows is used; otherwise, rule is
used.
As of
Oracle Database 10g, the rule-based optimizer has been desupported , and
therefore the new default value is all_rows.
Consequently, the values choose and rule are no longer supported
Any
tables that missed the most recent pass of statistics generation will then be
subject to dynamic sampling. This is because the default value in 10g for the
parameter optimizer_dynamic_sampling
is 2 (which means use dynamic sampling on any table without statistics), rather
than 1, as it was in 9i.
Courtesy
: CBO Fundamentals by Johnathan Lewis
and Troubleshooting Oracle Performance
by Christian Antognini
No comments:
Post a Comment