병렬 쿼리 수행시 테이블에 분배와 조인 조정하기 위한 오라클 hint

 

1. 적용 사항

  - 파티션 키를 무시하고 다른 키로 분배를 하고자 할때

  - 통계 정보가 부정확하여 실행 계획을 고정 시키고자 할때

  - 옵티마이저가 파티션 데이터를 사용하지 않고 동적 재분배를 하고자 할때 등

 

2. 사용 방법

  - 기본 Syntax

    /*+  pq_distribute( inner table명, outer_distribution, inner_distribution) */

   inner table : 순서상 조인이 되는 테이블

   outer_distribution :  데이터 분배 방식 지정 (none / partition / broadcast / hash)

   inner_distribution :  데이터 분배 방식 지정 (none / partition / broadcast / hash) 

 

   select /*+ leading(a) use_hash(b) parallel(a 4) parallel(b 4) pq_distribute(b, none, hash) */ *

   from t1 a, t2 b

   where t1.id = t2.id

   => outer table a를 가지고 inner table b를 hash 조인 수행, b테이블 데이터를 hash 방식으로 동적 파티션진행

 

3. 분배 방식 지정

  - pq_distribute(inner, none, none)   : full-partition 조인으로 양쪽 테이블 둘다 조인 컬럼에 대해 같은 기준으로 파티션

                                                 되어 있어야 동작

  - pq_distribute(inner, partition, none) : 부분 partition 조인으로 inner 테이블 조인 키 컬럼으로 파티션 되어 있어야 함

  - pq_distribute(inner, none, partition) : 부분 partition 조인으로 outer 테이블 조인 키 컬럼으로 파티션 되어 있어야 함

  - pq_distribute(inner, hash, hash) : 조인 키 컬럼으로 해쉬 함수 적용후 반환되는 hash 값으로 양쪽 테이블을 동적 

                                               파티션하여 동작

  - pq_distribute(inner, broadcast, none) : outer 테이블 데이터를 broadcast하여 조인 수행

  - pq_distribute(inner, none, broadcast) : innter 테이블 데이터를 broadcast하여 조인 수행

                                                      

'RDB > Oracle' 카테고리의 다른 글

oracle rac patch  (0) 2019.07.25
ogg 18c - exclude 데이터  (0) 2019.07.02
Oracle 테이블 상세내용 확인  (0) 2019.06.04
oracle character set 변경  (0) 2019.05.29
오라클 DB 패치 버전  (0) 2019.04.24

+ Recent posts