인덱스조인 예제


- 테이블 생성
create table index_join
(
gubun varchar2(1),
work_date varchar2(8),
flag varchar2(5),
code varchar2(5),
test_desc varchar2(100)
);


- 인덱스 생성
create index index_join_n01 on index_join
(gubun,work_date)
;

create index index_join_n02 on index_join
(flag)
;

create index index_join_n03 on index_join
(code,flag)
;


- 테스트데이터 입력
insert into index_join
select 'A',to_char(sysdate - rownum,'yyyymmdd'), rownum,'A','asdadasdadas' from dual connect by level <= 10000
union all
select 'B',to_char(sysdate - rownum,'yyyymmdd'), rownum,'A','asdadasdadas' from dual connect by level <= 10000
;

commit;


- SQL 수행
select gubun, flag 
  from index_join
 WHERE CODE= 'A'
   AND GUBUN >='1'

  • TRACE 결과