Space Shift !
인덱스 강제로 태우기..(너 너무 안탄다..) 본문
분명 인덱스 컬럼순으로 조건절을 태웠는데...
인덱스를 타지 않는다..
인덱스 컬럼순이다..
GJNO1
ACCTKDCD
ACCTDATE
BUSDATE
FINICD
PARTCD
ACCTCD
CHITNO
INDEX 시스템에 맞기기-----------------------------
select acctcd,count(distinct gjno1),to_char(sum(exchamt),'999,999,999,999,990')
from (
select acctcd,gjno1,exchamt
from test
where gjno1 in(select code2 from test where code1 = 'GJNO1')
and acctkdcd = '7102'
and acctdate = to_date('&&yymmdd','yyyymmdd')
and busdate = to_date('&yymmdd','yyyymmdd')
and finicd in('1','2')
and partcd = '3101'
and acctcd in('551010301','551010303')
and jukyo = 'TEST'
)
group by acctcd
PLAN------------------------------------
SELECT STATEMENT Cost =
SORT GROUP BY
MERGE JOIN
SORT JOIN
VIEW
SORT UNIQUE
REMOTE
SORT JOIN
REMOTE
------------------------------------------
Elapsed: 00:14:46.42
INDEX 강제로 태우기-----------------------
select /*+ INDEX_FFS(IMSI_N320) +*/ acctcd,count(distinct gjno1),to_char(sum(exchamt),'999,999,999,999,990')
from (
select acctcd,gjno1,exchamt
from test
where gjno1 in(select code2 from test where code1 = 'GJNO1')
and acctkdcd = '7102'
and acctdate = to_date('&&yymmdd','yyyymmdd')
and busdate = to_date('&yymmdd','yyyymmdd')
and finicd in('1','2')
and partcd = '3101'
and acctcd in('551010301','551010303')
and jukyo = 'TEST'
)
group by acctcd
PLAN------------------------------------
SELECT STATEMENT Cost = 198
SORT GROUP BY
NESTED LOOPS
VIEW
SORT UNIQUE
REMOTE
REMOTE
------------------------------------------
Elapsed: 00:00:04.07
차이가 나도 너무 난다... 근데 의문인점이... 왜 인덱스를 타지 않을까??
강제로 인덱스를 태워야한다면..
처음부터 명시하라고 하든가.. 왜 옵션처럼 해놓구는..
너무어렵당.. 공부가 필요해 ??? 보내줘~~~ ㅋ