본문 바로가기
DBMS/ORACLE

OPTIMIZER_DYNAMIC_SAMPLING

by 드바 2022. 7. 6.

오라클 Dynamic Sampling

통계정보가 존재하지 않을 경우에 오라클은 Dynamic Sampling Level에 따라 Dynamic Sampling 작업을 수행한다.

즉 Sampling Level에 따라 데이터블록들을 Sampling한 후 통계 정보를 생성해 SQL 문을 수행한다.

 

 

Dynamic Sampling 관련 힌트

-- dynamic_sampling 사용 안함
select /*+ dynamic_sampling(0) */ * from iggy_pop where code1=42 and code2=42 ;

-- dynamic_sampling level 11
SELECT /*+ dynamic_sampling(emp 11) */
       empno, ename, job, sal
FROM   emp
WHERE  deptno = 30
;

 

OPIMIZER_DYNAMIC_SAMPLING

https://docs.oracle.com/database/121/REFRN/GUID-43655FC3-3C32-486B-8B11-8C20C152618D.htm#REFRN10140

 

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. Note: Dynamic statistics were called dynamic sampling in releases before Oracle Database 12c

docs.oracle.com

 

Dynamic Statistics Levels

https://docs.oracle.com/database/121/TGSQL/tgsql_astat.htm#TGSQL451

 

Managing Optimizer Statistics: Advanced Topics

You can run the DBMS_STATS statistics gathering procedures in reporting mode. In this case, the optimizer does not actually gather statistics, but reports objects that would be processed if you were to use a specified statistics gathering function. Table 1

docs.oracle.com

 

댓글