Detailed analysis of Oracle hints adjustment mechanism

Source: Internet
Author: User

The following article mainly analyzes the adjustment mechanism of Oracle hints related practical applications in detail. We will first introduce the adjustment mechanism from a 10 Gb database, we can use more updated optimizer hints to control the optimization behavior. Now let's quickly parse these powerful new Oracle hints:

 
 
  1. spread_min_analysis 

With this hint, you can ignore the Compilation Time Optimization rules for workbooks such as detailed graph analysis. Other optimizations, such as creating filters to selectively locate the workbook access structure and restrict the revision rules, are available.

Because the number of rules is very large, the workbook analysis will be very long. This prompt helps us reduce the resulting compilation time by hundreds of hours.

Example:

 
 
  1. SELECT /*+ SPREAD_MIN_ANALYSIS */ ...  
  2. spread_no_analysis  

With this hint, No workbook analysis is possible. Similarly, this hint can be used to ignore the revision rules and filter the generation. If a spreadsheet analysis exists, the Compilation Time can be minimized.

Example:

 
 
  1. SELECT /*+ SPREAD_NO_ANALYSIS */ ...  
  2. use_nl_with_index  

This hint allows CBO to add a specific table to another original row through nested loops. A specific table is used as an internal table only in the following cases: if no label is specified, CBO must be able to use some labels, and at least one of these labels can be used as the index key value for judgment; otherwise, CBO must be able to add at least one tag as the index key value to the judgment.

Example:

 
 
  1. SELECT /*+ USE_NL_WITH_INDEX (polrecpolrind) */ ...  
  2. CARDINALITY  

This hint defines the base number returned by the query or query. Note that if no table is defined, the base number is the total number of rows returned by the entire query.

Example:

 
 
  1. SELECT /*+ CARDINALITY ( [tablespec] card ) */  
  2. SELECTIVITY  

This hint defines a selective evaluation of the query or query. If only one table is defined, the row part that satisfies all single table judgments in the defined table is optional. If a series of tables are defined, selectivity refers to the row section in the result after all tables that meet all available judgments in any order are merged.

Example:

 
 
  1. SELECT /*+ SELECTIVITY ( [tablespec] sel ) */ 

However, note that if both Oracle hints CARDINALITY and SELECTIVITY are defined in the same batch of tables, both are ignored.

 
 
  1. no_use_nl 

Hint no_use_nl enables CBO to execute loop nesting. By using the specified table as an internal table, each specified table is connected to another original row. With this hint, only hash join and sort-merge joins are considered for the specified table.

Example:

 
 
  1. SELECT /*+ NO_USE_NL ( employees ) */ ...  
  2. no_use_merge  

This hint allows CBO to reject sort-merge from adding each specified table to another original row by using the specified table as an internal table.

Example:

 
 
  1. SELECT /*+ NO_USE_MERGE ( employees dept ) */ ...  
  2. no_use_hash  

This hint allows CBO to reject hash joins from adding each specified table to another original row by using the specified table as an internal table.

Example:

 
 
  1. SELECT /*+ NO_USE_HASH ( employees dept ) */ ...  
  2. no_index_ffs  

This hint denies CBO from performing fast full-index scan on the specified tags in the specified table.

 
 
  1. Syntax: /*+ NO_INDEX_FFS ( tablespecindexspec ) */ 

As the Oracle optimizer matures, Oracle will inevitably increase its reserves of tools for adjusting SQL statements. Of course, discussing all the complicated New Oracle hints of Oracle10g SQL is far beyond the scope of this article. Readers can get more information about Oracle10g from Mike Ault's New Oracle Database 10g New Features.

Article by: http://database.csdn.net/c_oracle/tag/2

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.