Presentation is loading. Please wait.

Presentation is loading. Please wait.

SQL Tuning.

Similar presentations


Presentation on theme: "SQL Tuning."— Presentation transcript:

1 SQL Tuning

2 Optimizer Tasks Oracle optimizer performs the following functions when evaluating a SQL statement: Evaluates the expressions and conditions contained in the SQL statement Transforms complex queries into an equivalent join query Chooses an optimization goal, either the Cost-based Optimizer (CBO) or the Rule-based Optimizer (RBO) Determines how to access each table to retrieve data Determines the order of table joins for statements involving more than two tables Chooses the type of join to be performed for each pair

3 Optimizer Modes

4 Optimizer Goal

5 Rule-based Optimizer Ranks

6 Cost-based Optimizer Process
CHOOSE: Oracle chooses the best and most efficient path to execute and retrieve data. Optimizer can select a cost-access method when statistics are available or a rule-based access method if it is faster. This setting is the most common mode used. ALL_ROWS: Oracle uses cost based access methods regardless of statistics availability. This optimizer priority is to retrieve all rows with the minimum amount of resource consumption. This option often used in Web applications. FIRST_ROWS: Oracle uses a mix of cost-based access methods and heuristics to retrieve the first few rows fast. This option is often used in FORMS client/server applications. FIRST_ROWS_N: Where N is 1, 10, 100, or Uses the cost-based access method to retrieve rows the most efficient way.

7 Cost-based Optimizer Process (continued)

8 Cost-based Optimizer Access Paths

9 Cost-based Optimizer Access Paths (continued)

10 Execution Plan Interpretation

11 Optimizer Parameters Optimizer Performance: Optimizer Behavior:
OPTIMIZER_DYNAMIC_SAMPLING OPTIMIZER_FEATURES_ENABLE OPTIMIZER_INDEX_CACHING OPTIMIZER_INDEX_COST_ADJ OPTIMIZER_MAX_PERMUTATIONS Optimizer Behavior: CURSOR_SHARING DB_FILE_MULTIBLOCK_READ_COUNT HASH_AREA_SIZE HASH_JOIN_ENABLED PARTITION_VIEW_ENABLED QUERY_REWRITE_ENABLED SORT_AREA_SIZE STAR_TRANSFORMATION_ENABLED

12 Optimizer Hints

13 Optimizer Hints Syntax

14 Classification of V$SQL Columns


Download ppt "SQL Tuning."

Similar presentations


Ads by Google