순위 | 액세스경로 | 설명 |
---|---|---|
1 | Single Row By Rowid | ROWID에 의한 단일 로우 |
2 | Single Row By Cluster Join | 클러스터 조인에 의한 단일 로우 |
3 | Single Row By Hash Cluster Key whit Unique or Primary Key | 유일하거나 PK를 가진 해시 클러스터키에 의한 단일 로우 |
4 | Single Row By Unique or Primary Key | 유일하거나 PK에 의한 단일 로우 |
5 | Clustered Join | 클러스터 조인 |
6 | Hash Cluster Key | 해시 클러스터 키 |
7 | Indexed Cluster Key | 인덱스 클러스터 키 |
8 | Composite Index | 복합 컬럼 인덱스 |
9 | Single-Column Indexes | 단일 컬럼 인덱스 |
10 | Bounded Range Search on Indexed Columns | 인덱스기 구성된 컬럼에서 제한된 범위 검색 |
11 | Unbounded Range Search on Indexed Columns | 인덱스가 구성된 컬럼에서 무제한 범위 검색 |
12 | Sort Merge Join | 정렬-병합 조인 |
13 | MAX or MIN of Indexed Column | 인덱스가 구성된 열에서 MAX 또는 MIN |
14 | ORDER BY on Indexed Column | 인덱스가 구성된 열에서 ORDER BY |
15 | Full Tabel Scan | 풀 테이블 스캔 |
INDEX
-----
EMP_JOB : JOB
EMP_SAL : SAL
PK_EMP : EMPNO (UNIQUE)
존재해야된다고해서
job, sal 은 인덱스가 존재하지않아서 생성
CREATE INDEX JOB ON EMP
(JOB)
CREATE INDEX SAL ON EMP
(SAL)
-- 예제형태(규칙10) --
select ename
from EMP
where job='SALESMAN'
and sal between 3000 and 6000
------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | | | 2 (100)| |
|* 1 | TABLE ACCESS BY INDEX ROWID| EMP | 1 | 18 | 2 (0)| 00:00:01 |
|* 2 | INDEX RANGE SCAN | SAL | 3 | | 1 (0)| 00:00:01 |
------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter("JOB"='SALESMAN')
2 - access("SAL">=3000 AND "SAL"<=6000)
-- sal 에 to_number로(규칙9) --
select ename
from EMP
where job='SALESMAN'
and to_number(sal) between 3000 and 6000
------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | | | 2 (100)| |
|* 1 | TABLE ACCESS BY INDEX ROWID| EMP | 1 | 18 | 2 (0)| 00:00:01 |
|* 2 | INDEX RANGE SCAN | JOB | 3 | | 1 (0)| 00:00:01 |
------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
1 - filter((TO_NUMBER(TO_CHAR("SAL"))>=3000 AND
TO_NUMBER(TO_CHAR("SAL"))<=6000))
2 - access("JOB"='SALESMAN')
SELECT *
FROM EMP A, DEPT B
WHERE A.DEPTNO = B.DEPTNO
----------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
----------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | | | 4 (100)| |
| 1 | NESTED LOOPS | | 14 | 798 | 4 (0)| 00:00:01 |
| 2 | TABLE ACCESS FULL | EMP | 14 | 518 | 3 (0)| 00:00:01 |
| 3 | TABLE ACCESS BY INDEX ROWID| DEPT | 1 | 20 | 1 (0)| 00:00:01 |
|* 4 | INDEX UNIQUE SCAN | PK_DEPT | 1 | | 0 (0)| |
----------------------------------------------------------------------------------------
Query Block Name / Object Alias (identified by operation id):
-------------------------------------------------------------
1 - SEL$1
2 - SEL$1 / A@SEL$1
3 - SEL$1 / B@SEL$1
4 - SEL$1 / B@SEL$1
Predicate Information (identified by operation id):
---------------------------------------------------
4 - access("A"."DEPTNO"="B"."DEPTNO")
Column Projection Information (identified by operation id):
-----------------------------------------------------------
1 - "A"."EMPNO"[NUMBER,22], "A"."ENAME"[VARCHAR2,10], "A"."JOB"[VARCHAR2,9],
"A"."MGR"[NUMBER,22], "A"."HIREDATE"[DATE,7], "A"."SAL"[NUMBER,22],
"A"."COMM"[NUMBER,22], "A"."DEPTNO"[NUMBER,22], "B"."DEPTNO"[NUMBER,22],
"B"."DNAME"[VARCHAR2,14], "B"."LOC"[VARCHAR2,13]
2 - "A"."EMPNO"[NUMBER,22], "A"."ENAME"[VARCHAR2,10], "A"."JOB"[VARCHAR2,9],
"A"."MGR"[NUMBER,22], "A"."HIREDATE"[DATE,7], "A"."SAL"[NUMBER,22],
"A"."COMM"[NUMBER,22], "A"."DEPTNO"[NUMBER,22]
3 - "B"."DEPTNO"[NUMBER,22], "B"."DNAME"[VARCHAR2,14], "B"."LOC"[VARCHAR2,13]
4 - "B".ROWID[ROWID,10], "B"."DEPTNO"[NUMBER,22]
-- 1번
SELECT *
FROM EMP A, DEPT B
WHERE A.DEPTNO = B.DEPTNO
AND A.JOB='SALESMAN'
--------------------------------------------------------------------------------------------------
| Id | Operation | Name | Starts | E-Rows | A-Rows | A-Time | Buffers |
--------------------------------------------------------------------------------------------------
| 1 | NESTED LOOPS | | 1 | 3 | 4 |00:00:00.01 | 14 |
|* 2 | TABLE ACCESS FULL | EMP | 1 | 3 | 4 |00:00:00.01 | 8 |
| 3 | TABLE ACCESS BY INDEX ROWID| DEPT | 4 | 1 | 4 |00:00:00.01 | 6 |
|* 4 | INDEX UNIQUE SCAN | PK_DEPT | 4 | 1 | 4 |00:00:00.01 | 2 |
--------------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - filter("A"."JOB"='SALESMAN')
4 - access("A"."DEPTNO"="B"."DEPTNO")
-- 2번
SELECT *
FROM EMP A, DEPT B
WHERE A.DEPTNO = B.DEPTNO
AND A.JOB='SALESMAN'
AND b.DNAME = 'SALES'
--------------------------------------------------------------------------------------------------
| Id | Operation | Name | Starts | E-Rows | A-Rows | A-Time | Buffers |
--------------------------------------------------------------------------------------------------
| 1 | NESTED LOOPS | | 1 | 1 | 4 |00:00:00.01 | 14 |
|* 2 | TABLE ACCESS FULL | EMP | 1 | 3 | 4 |00:00:00.01 | 8 |
|* 3 | TABLE ACCESS BY INDEX ROWID| DEPT | 4 | 1 | 4 |00:00:00.01 | 6 |
|* 4 | INDEX UNIQUE SCAN | PK_DEPT | 4 | 1 | 4 |00:00:00.01 | 2 |
--------------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - filter("A"."JOB"='SALESMAN')
3 - filter("B"."DNAME"='SALES')
4 - access("A"."DEPTNO"="B"."DEPTNO")
-- 책에서 설명한 내용은 이해가안됨(말이너무어렵게설명되어있슴)
- 강좌 URL : http://www.gurubee.net/lecture/2386
- 구루비 강좌는 개인의 학습용으로만 사용 할 수 있으며, 다른 웹 페이지에 게재할 경우에는 출처를 꼭 밝혀 주시면 고맙겠습니다.~^^
- 구루비 강좌는 서비스 제공을 위한 목적이나, 학원 홍보, 수익을 얻기 위한 용도로 사용 할 수 없습니다.