많은 도움 받고 있고 있습니다.
한가지 도움이 필요해 이렇게 글을 올립니다.
SELECT A.FACTORY,B.CTG3, A.LOT_ID ,A.MAT_ID,A.MAT_DESC,A.MAT_TYPE,A.UNIT,A.SLOC,
D.QTY,
A.AVAIL_IN_J_QTY AS AVAIL_QTY,
A.AVALIABLE_QTY, A.UNRESTRICT_QTY, A.RESERVED_QTY, A.INSP_QTY, A.BLOCKED_QTY, A.AVAIL_IN_J_QTY, A.DEPOSIT_PR_QTY,
B.IN_QTY, ROUND((A.AVAIL_IN_J_QTY + A.INSP_QTY +A.BLOCKED_QTY) / B.IN_QTY,3) AS FACTOR_COUNT,
A.DEADLINE_DATE, A.EXPIRE_DATE,
A.PURITY, A.PURITY_UNIT, A.NMP, A.NMP_UNIT, C.REMARKK
FROM TI_STOCK A, TS_MATERIAL B, TD_STOCK_REMARK C
,(SELECT FACTORY, MAT_ID, LOT_ID, QTY FROM MESMGR.CWIPBATMAT WHERE FACTORY ='K001' AND MVT IN ('901','Z63') AND QTY>0) D
WHERE A.MAT_ID = B.MAT_ID
AND (A.AVAIL_IN_J_QTY >0 OR A.INSP_QTY >0 OR A.BLOCKED_QTY >0 OR A.RESERVED_QTY >0)
AND A.FACTORY = C.FACTORY(+) AND A.MAT_ID =C.MAT_ID(+) AND A.LOT_ID = C.LOT_ID(+) AND A.SLOC = C.SLOC(+)
AND A.FACTORY = D.FACTORY(+) AND A.MAT_ID = D.MAT_ID(+) AND A.LOT_ID = D.LOT_ID(+)
AND B.CTG1 = 'G01'
AND B.MAT_TYPE = 'FERT'
ORDER BY A.FACTORY, A.MAT_ID, A.LOT_ID, A.EXPIRE_DATE ASC,A.LOT_ID ASC;
이거에 실행 계획이
0 SELECT STATEMENT Optimizer=FIRST_ROWS (Cost=208K Card=129 Bytes=32K)
1 0 SORT (ORDER BY) (Cost=208K Card=129 Bytes=32K)
2 1 NESTED LOOPS (OUTER) (Cost=208K Card=129 Bytes=32K)
3 2 NESTED LOOPS (Cost=208K Card=129 Bytes=23K)
4 3 NESTED LOOPS (Cost=207K Card=827 Bytes=109K)
5 4 TABLE ACCESS (BY INDEX ROWID) OF 'MESMGR.CWIPBATMAT' (TABLE) (Cost=203K Card=4K Bytes=108K)
6 5 INDEX (RANGE SCAN) OF 'MESMGR.PK_CWIPBATMAT' (INDEX (UNIQUE)) (Cost=4K Card=432K)
7 4 TABLE ACCESS (BY INDEX ROWID) OF 'TI_STOCK' (TABLE) (Cost=2 Card=1 Bytes=104)
8 7 INDEX (RANGE SCAN) OF 'TI_STOCK_PK' (INDEX (UNIQUE)) (Cost=1 Card=1)
9 3 TABLE ACCESS (BY INDEX ROWID) OF 'TS_MATERIAL' (TABLE) (Cost=1 Card=1 Bytes=51)
10 9 INDEX (UNIQUE SCAN) OF 'TS_MATERIAL_BAK_PK' (INDEX (UNIQUE)) (Cost=0 Card=1)
11 2 TABLE ACCESS (BY INDEX ROWID) OF 'TD_STOCK_REMARK' (TABLE) (Cost=1 Card=1 Bytes=68)
12 11 INDEX (UNIQUE SCAN) OF 'TD_STOCK_REMARK_PK' (INDEX (UNIQUE)) (Cost=0 Card=1)
아무래도... OUTER JOIN 이 문제이지 싶어요... 쿼리 튜닝 방법 없을 까요?
부탁 드립니다.
감사합니다. |