2014. 4. 28. 21:37

[Oracle] LEADING HINT

1. Before SQL & Plan

 

:

  UNION ALL
  SELECT  A.OWNERID,
                A.CUSTID OWNERCUSTID,

:

 

Call     Count CPU Time Elapsed Time       Disk      Query    Current       Rows
------- ------ -------- ------------ ---------- ---------- ---------- ----------
Parse        1    0.320        0.318          0          9          0          0
Execute      1    0.000        0.000          0          0          0          0
Fetch        2   38.670      854.077     357665    2669098          0          2
------- ------ -------- ------------ ---------- ---------- ---------- ----------
Total        4   38.990      854.396     357665    2669107          0          2

 

 

1.1 문제점 및 해결책


  - UNION ALL의 두번째 SQL 집합에서 TPURCHASEORDERHI 테이블 ACCESS시 데이터 필터링이 제대로 이루어 지지 않아 조인시 성능저하 현상 발생
  - TTASKTRANS 테이블이 leading 될 수 있도록 힌트 적용하여 성능개선(854s -> 1s)

 

 

2. After SQL & Plan

 

:

  UNION ALL
  SELECT  /*+ LEADING(TT) */ A.OWNERID,
                A.CUSTID OWNERCUSTID,

:

     FROM  TTASKTRANS TT,

:

 

Call     Count CPU Time Elapsed Time       Disk      Query    Current       Rows
------- ------ -------- ------------ ---------- ---------- ---------- ----------
Parse        1    0.380        0.375          0          6          0          0
Execute      1    0.000        0.000          0          0          0          0
Fetch        2    0.510        0.511          0     114195          0          2
------- ------ -------- ------------ ---------- ---------- ---------- ----------
Total        4    0.890        0.887          0     114201          0          2

 

 

'DB Tuning' 카테고리의 다른 글

[Oracle] LEADING HINT  (0) 2014.04.28
[Oracle] HINT 정리  (0) 2014.04.28
[Oracle] SUBQUERY -> INLINE VIEW  (0) 2014.04.28
[Oracle] INTERSECT, MINUS -> JOIN, NOT EXISTS  (0) 2014.04.28
Trackback 0 Comment 0