SQL> SELECT /*+ gather_plan_statistics INDEX( X ORDDATE_INDEX ) LEADING( A ) */ COUNT(*)
2 FROM "ORDER" X
3 WHERE ORDDATE LIKE '20110621%'
4 AND EXISTS ( SELECT /*+ HASH_SJ */ 'O'
5 FROM DEPT Y
6 WHERE Y.DEPTNO = X.SALDEPTNO
7 AND Y.TYPE1 = 1 );
COUNT(*)
----------
15832
SQL> @XPLAN
------------------------------------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Starts | E-Rows | A-Rows | A-Time | Buffers | OMem | 1Mem | Used-Mem |
------------------------------------------------------------------------------------------------------------------------------------
| 1 | SORT AGGREGATE | | 1 | 1 | 1 |00:00:00.12 | 678 | | | |
|* 2 | HASH JOIN SEMI | | 1 | 709 | 15832 |00:00:00.15 | 678 | 3256K| 1861K| 6674K (0)| <--
| 3 | TABLE ACCESS BY INDEX ROWID| ORDER | 1 | 3899 | 86400 |00:00:00.60 | 675 | | | |
|* 4 | INDEX RANGE SCAN | ORDDATE_INDEX | 1 | 3899 | 86400 |00:00:00.26 | 316 | | | |
|* 5 | TABLE ACCESS FULL | DEPT | 1 | 2 | 2 |00:00:00.01 | 3 | | | |
------------------------------------------------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - access("Y"."DEPTNO"="X"."SALDEPTNO")
4 - access("ORDDATE" LIKE '20110621%')
filter("ORDDATE" LIKE '20110621%')
5 - filter("Y"."TYPE1"=1)
SQL> SELECT /*+ gather_plan_statistics INDEX( X ORDDATE_INDEX ) */ COUNT(*)
2 FROM "ORDER" X
3 WHERE ORDDATE LIKE '20110621%'
4 AND EXISTS ( SELECT /*+ HASH_SJ */ 'O'
5 FROM DEPT Y
6 WHERE Y.DEPTNO = X.SALDEPTNO
7 AND Y.TYPE1 = 1 );
COUNT(*)
----------
15832
SQL> @XPLAN
------------------------------------------------------------------------------------------------------------------------------------
| Id | Operation | Name | Starts | E-Rows | A-Rows | A-Time | Buffers | OMem | 1Mem | Used-Mem |
------------------------------------------------------------------------------------------------------------------------------------
| 1 | SORT AGGREGATE | | 1 | 1 | 1 |00:00:00.10 | 678 | | | |
|* 2 | HASH JOIN RIGHT SEMI | | 1 | 709 | 15832 |00:00:00.14 | 678 | 1396K| 1396K| 474K (0)| <--
|* 3 | TABLE ACCESS FULL | DEPT | 1 | 2 | 2 |00:00:00.01 | 3 | | | |
| 4 | TABLE ACCESS BY INDEX ROWID| ORDER | 1 | 3899 | 86400 |00:00:00.60 | 675 | | | |
|* 5 | INDEX RANGE SCAN | ORDDATE_INDEX | 1 | 3899 | 86400 |00:00:00.26 | 316 | | | |
------------------------------------------------------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - access("Y"."DEPTNO"="X"."SALDEPTNO")
3 - filter("Y"."TYPE1"=1)
5 - access("ORDDATE" LIKE '20110621%')
filter("ORDDATE" LIKE '20110621%')
26 개의 행이 선택되었습니다.
- 강좌 URL : http://www.gurubee.net/lecture/4455
- 구루비 강좌는 개인의 학습용으로만 사용 할 수 있으며, 다른 웹 페이지에 게재할 경우에는 출처를 꼭 밝혀 주시면 고맙겠습니다.~^^
- 구루비 강좌는 서비스 제공을 위한 목적이나, 학원 홍보, 수익을 얻기 위한 용도로 사용 할 수 없습니다.