oracle implementation plan (a) ---- Overview

(1) What is the execution plan
SQL is a fool language, each condition is a demand, sequential access different on the formation of different execution plan. Oracle must make a choice, once there is only one access path. An access path is an implementation plan.

Select (2) the implementation of the plan
is usually a multiple SQL execution plans, then how do we choose? The kind of lower execution costs, it means better performance, faster, we would choose which one, a process called Oracle resolution process, then Oracle will better execution plans into the Shared Pool SGA's, subsequent re-execute the same SQL in the Shared Pool just get on the line, you do not need to go to analysis.

(3) implementation plan based on selected
to run the program according to statistics.

(4) statistical information
(4.1) What are the statistics on
the number of records, number of blocks, the specific view dba_tables / dba_indexes

How to (4.2) Oracle to collect statistics
① Oracle will choose statistics in a particular collection of tables and indexes period of time (default Monday to Friday: 22:00, Saturday and Sunday: 06:00), the user can adjust , mainly to avoid the peak;
analysis ② tables and indexes have a threshold limit, exceeding the threshold value will automatically be analyzed. If the data is not the amount of change, Oracle is not going to analyze;
③ collecting flexible manner. May be performed for the partition table in a partition, parallelism may be employed to collect information on tables and indexes;

(4.3) how to collect statistical information

- collecting table statistics 
Exec dbms_stats.gather_table_stats (ownname =>  ' LIJIAMAN ' , tabname =>  ' Test02 ' , estimate_percent =>  10 , the method_opt =>  ' for an indexed All Columns ' ); 

- collecting index statistics 
Exec the dbms_stats. gather_index_stats (ownname =>  ' LIJIAMAN ' , indname =>  ' ID_IDX ' , estimate_percent =>  10 , Degree =>  ' . 4 ' );

--While collecting statistics on tables and indexes 
Exec dbms_stats.gather_table_stats (ownname =>  ' LIJIAMAN ' , tabname =>  ' Test02 ' , estimate_percent =>  10 , the method_opt =>  ' for an indexed Columns All ' , Cascade  => to true);

(5) dynamic sampling
Oracle statistics are gathered at a certain time each day under normal circumstances, for the new table, Oracl how to gather statistics? Dynamic sampling.
ON AUTOTRACE the SET
the SET LINESIZE 1000
- execute SQL statements
- there will be dynamic sampling used for this statement (level = 2) Keyword

 

 

【carry out】 

 

Reference books: "harvest, more than SQL optimization"

Guess you like

Origin www.cnblogs.com/lijiaman/p/11488820.html