select *
From SF_TEST
where ST_DATE = '20160101'
-----------------------------------------------------------
0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=0 Card=1 Bytes=2K)
1 0 TABLE ACCESS (BY INDEX ROWID) OF 'SF_TEST' (TABLE) (Cost=0 Card=1 Bytes=2K)
2 1 INDEX (RANGE SCAN) OF 'IX_SF_TEST_ST_DATE_ED_DATE' (INDEX) (Cost=0 Card=1)
select ED_DATE
From SF_TEST
where ED_DATE = '20160101'
-----------------------------------------------------------
0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=1 Card=1 Bytes=6)
1 0 INDEX (FULL SCAN) OF 'IX_SF_TEST_ST_DATE_ED_DATE' (INDEX) (Cost=1 Card=1 Bytes=6)
Index Full Scan 효용성
인덱스를 이용한 소트 연산 대체
select /*+ first_rows */ *
From SF_TEST
where ed_DATE > '20160101'
ORDER BY st_DATE
-----------------------------------------------------------
0 SELECT STATEMENT Optimizer=HINT: FIRST_ROWS (Cost=2 Card=179 Bytes=391K)
1 0 TABLE ACCESS (BY INDEX ROWID) OF 'SF_TEST' (TABLE) (Cost=2 Card=179 Bytes=391K)
2 1 INDEX (FULL SCAN) OF 'IX_SF_TEST_ST_DATE_ED_DATE' (INDEX) (Cost=1 Card=2)
select * from 사원 where 성별 = '남' and 연봉 between 2000 and 4000
버퍼 Pinning을 이용한 Skip 원리
Index Skip Scan 이 작동하기 위한 조건
In-List Iterator 와의 비교
-Index Range Scan 동일한 스캔방식, 인덱스를 뒤에서부터 앞쪽으로 스캔하기 때문에 내림차순으로 정렬된 결과집합
And-Equal
Index Combine
select
select /*+/*+ index_combine(eindex_combine(e emp_deptno_idx emp_job_idx) */ *
from scott.emp e
where deptno = 30
and job = 'SALESMAN'
emp_deptno_idx emp_job_idx) */ *
from scott.emp e
where deptno = 30
and job = 'SALESMAN'
-----------------------------------------------------------
0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=3 Card=1 Bytes=38)
1 0 TABLE ACCESS (BY INDEX ROWID) OF 'SCOTT.EMP' (TABLE) (Cost=3 Card=1 Bytes=38)
2 1 BITMAP CONVERSION (TO ROWIDS)
3 2 BITMAP AND
4 3 BITMAP CONVERSION (FROM ROWIDS)
5 4 INDEX (RANGE SCAN) OF 'EMP_JOB_IDX' (INDEX) (Cost=1)
6 3 BITMAP CONVERSION (FROM ROWIDS)
7 6 INDEX (RANGE SCAN) OF 'EMP_DEPTNO_IDX' (INDEX) (Cost=1)
Index join
select /*+ index_join(e emp_deptno_idx emp_job_idx) */ deptno , job
from scott.emp e
where deptno = 30 and job = 'SALESMAN'
-----------------------------------------------------------
0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=3 Card=1 Bytes=11)
1 0 VIEW OF 'SCOTT.index$_join$_001' (VIEW) (Cost=3 Card=1 Bytes=11)
2 1 HASH JOIN
3 2 INDEX (RANGE SCAN) OF 'EMP_JOB_IDX' (INDEX) (Cost=1 Card=1 Bytes=11)
4 2 INDEX (RANGE SCAN) OF 'EMP_DEPTNO_IDX' (INDEX) (Cost=1 Card=1 Bytes=11)
select /*+ index_join(e emp_deptno_idx emp_job_idx) */ deptno , job
from scott.emp e
where deptno = 30 and job = 'SALESMAN'
-----------------------------------------------------------
0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=3 Card=1 Bytes=11)
1 0 VIEW OF 'SCOTT.index$_join$_001' (VIEW) (Cost=3 Card=1 Bytes=11)
2 1 HASH JOIN
3 2 INDEX (RANGE SCAN) OF 'EMP_JOB_IDX' (INDEX) (Cost=1 Card=1 Bytes=11)
4 2 INDEX (RANGE SCAN) OF 'EMP_DEPTNO_IDX' (INDEX) (Cost=1 Card=1 Bytes=11)