{CODE:SQL}
SQL> SELECT /*+ gather_plan_statistics LEADING( D ) USE_MERGE( E ) FULL( D ) FULL ( E ) PARALLEL(D 4) PARALLEL(E 4) PQ_DISTRIBUTE(E ,HASH, HASH ) /COUNT()
2 FROM DEPT_NOPARTITION D, EMP_NOPARTITION E
3 WHERE E.DEPTNO = D.DEPTNO;
COUNT(*)
SQL> @XPLAN
Id | Operation | Name | Starts | E-Rows | A-Rows | A-Time | Buffers | OMem | 1Mem | Used-Mem | Used-Tmp |
1 | SORT AGGREGATE | 1 | 1 | 1 | 00:00:10.91 | 8 | |||||
2 | PX COORDINATOR | 1 | 4 | 00:00:10.80 | 8 | ||||||
3 | PX SEND QC (RANDOM) | :TQ10002 | 0 | 1 | 0 | 00:00:00.01 | 0 | ||||
4 | SORT AGGREGATE | 0 | 1 | 0 | 00:00:00.01 | 0 | |||||
5 | MERGE JOIN | 0 | 2888K | 0 | 00:00:00.01 | 0 | |||||
6 | SORT JOIN | 0 | 4 | 0 | 00:00:00.01 | 0 | 2048 | 2048 | 2048 (0) | ||
7 | PX RECEIVE | 0 | 4 | 0 | 00:00:00.01 | 0 | |||||
8 | PX SEND HASH | :TQ10000 | 0 | 4 | 0 | 00:00:00.01 | 0 | ||||
9 | PX BLOCK ITERATOR | 0 | 4 | 0 | 00:00:00.01 | 0 | |||||
| TABLE ACCESS FULL | DEPT_NOPARTITION | 0 | 4 | 0 | 00:00:00.01 | 0 | ||||
| SORT JOIN | 0 | 2888K | 0 | 00:00:00.01 | 0 | 69M | 2879K | 21M (1) | 16384 | |
12 | PX RECEIVE | 0 | 2888K | 0 | 00:00:00.01 | 0 | |||||
13 | PX SEND HASH | :TQ10001 | 0 | 2888K | 0 | 00:00:00.01 | 0 | ||||
14 | PX BLOCK ITERATOR | 0 | 2888K | 0 | 00:00:00.01 | 0 | |||||
| TABLE ACCESS FULL | EMP_NOPARTITION | 0 | 2888K | 0 | 00:00:00.01 | 0 |
Predicate Information (identified by operation id):
10 - access(:Z>=:Z AND :Z<=:Z)
11 - access("E"."DEPTNO"="D"."DEPTNO")
filter("E"."DEPTNO"="D"."DEPTNO")
15 - access(:Z>=:Z AND :Z<=:Z)
Note
39 개의 행이 선택되었습니다.
{CODE
PQ_DISTRIBUTE | ||
---|---|---|
{CODE:SQL} /*+ PQ_DISTRIBUTE( TABLE, OUTER_DISTRIBUTION, INNER_DISTRIBUTION ) */ | {CODE} | ㅋㅋㅋㅋㅋ |
{CODE:SQL} |
SQL> SELECT /*+ gather_plan_statistics
2 ORDERED
3 USE_HASH( D ) USE_HASH( E ) USE_HASH( PE )
4 FULL( D ) FULL( PE ) FULL( E )
5 PARALLEL(D 8) PARALLEL(E 8) PARALLEL(PE 8)
6 PQ_DISTRIBUTE(E, BROADCAST, NONE) PQ_DISTRIBUTE(PE, PARTITION, NONE ) */
7 COUNT(*)
8 FROM DEPT_NOPARTITION D, EMP_NOPARTITION E, EMP_PARTITION3 PE
9 WHERE D.DEPTNO = E.DEPTNO
10 AND E.DEPTNO = PE.DEPTNO
11 AND ROWNUM <= 40000000;
COUNT(*)
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:16.36 | 19 | ||||
| COUNT STOPKEY | 1 | 40M | 00:00:11.01 | 19 | |||||
3 | PX COORDINATOR | 1 | 40M | 00:00:11.01 | 19 | |||||
4 | PX SEND QC (RANDOM) | :TQ10002 | 0 | 4005G | 0 | 00:00:00.01 | 0 | |||
| COUNT STOPKEY | 0 | 0 | 00:00:00.01 | 0 | |||||
| HASH JOIN BUFFERED | 0 | 4005G | 0 | 00:00:00.01 | 0 | 24M | 4548K | 9477K (1) | |
7 | PX PARTITION HASH ALL | 0 | 4003K | 0 | 00:00:00.01 | 0 | ||||
8 | TABLE ACCESS FULL | EMP_PARTITION3 | 0 | 4003K | 0 | 00:00:00.01 | 0 | |||
9 | PX RECEIVE | 0 | 3998K | 0 | 00:00:00.01 | 0 | ||||
10 | PX SEND PARTITION (KEY) | :TQ10001 | 0 | 3998K | 0 | 00:00:00.01 | 0 | |||
| HASH JOIN | 0 | 3998K | 0 | 00:00:00.01 | 0 | 1517K | 1517K | 993K (0) | |
12 | PX RECEIVE | 0 | 4 | 0 | 00:00:00.01 | 0 | ||||
13 | PX SEND BROADCAST | :TQ10000 | 0 | 4 | 0 | 00:00:00.01 | 0 | |||
14 | PX BLOCK ITERATOR | 0 | 4 | 0 | 00:00:00.01 | 0 | ||||
| TABLE ACCESS FULL | DEPT_NOPARTITION | 0 | 4 | 0 | 00:00:00.01 | 0 | |||
16 | PX BLOCK ITERATOR | 0 | 3998K | 0 | 00:00:00.01 | 0 | ||||
| TABLE ACCESS FULL | EMP_NOPARTITION | 0 | 3998K | 0 | 00:00:00.01 | 0 |
Predicate Information (identified by operation id):
2 - filter(ROWNUM<=40000000)
5 - filter(ROWNUM<=40000000)
6 - access("E"."DEPTNO"="PE"."DEPTNO")
11 - access("D"."DEPTNO"="E"."DEPTNO")
15 - access(:Z>=:Z AND :Z<=:Z)
17 - access(:Z>=:Z AND :Z<=:Z)
{CODE} * 1 실제 플랜을 표현하라 * 2 FROM절에 나열된 순서되로 조인하라. * 3 PE 테이블과는 해시 조인, E 테이블과 해쉬조인하라 * 4 D, PE, E 테이블을 FTS 하라 * 5 D, PE, E 병렬로 처리하라 * 6 E 테이블과 조인할때 Outer table( D )을 BROADCAST 방식으로 변환 하라. PE 테이블과 조인 할때 Outer Table( E )을 Inner Table 맞쳐 파티션 하라. |
h3 (4) PQ_DISTRIBUTE 힌트를 이용한 튜닝 사례
{CODE:SQL} |
SQL> SELECT /*+ gather_plan_statistics
2 ORDERED
3 USE_HASH( D ) USE_HASH( E ) USE_HASH( PE )
4 FULL( D ) FULL( PE ) FULL( E )
5 PARALLEL(D 8) PARALLEL(E 8) PARALLEL(PE 8)
6 PQ_DISTRIBUTE(E, BROADCAST, NONE) PQ_DISTRIBUTE(PE, PARTITION, NONE ) */
7 COUNT(*)
8 FROM DEPT_NOPARTITION D, EMP_NOPARTITION E, EMP_PARTITION3 PE
9 WHERE D.DEPTNO = E.DEPTNO
10 AND E.DEPTNO = PE.DEPTNO
11 AND ROWNUM <= 40000000;
COUNT(*)
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:16.36 | 19 | ||||
| COUNT STOPKEY | 1 | 40M | 00:00:11.01 | 19 | |||||
3 | PX COORDINATOR | 1 | 40M | 00:00:11.01 | 19 | |||||
4 | PX SEND QC (RANDOM) | :TQ10002 | 0 | 4005G | 0 | 00:00:00.01 | 0 | |||
| COUNT STOPKEY | 0 | 0 | 00:00:00.01 | 0 | |||||
| HASH JOIN BUFFERED | 0 | 4005G | 0 | 00:00:00.01 | 0 | 24M | 4548K | 9477K (1) | |
7 | PX PARTITION HASH ALL | 0 | 4003K | 0 | 00:00:00.01 | 0 | ||||
8 | TABLE ACCESS FULL | EMP_PARTITION3 | 0 | 4003K | 0 | 00:00:00.01 | 0 | |||
9 | PX RECEIVE | 0 | 3998K | 0 | 00:00:00.01 | 0 | ||||
10 | PX SEND PARTITION (KEY) | :TQ10001 | 0 | 3998K | 0 | 00:00:00.01 | 0 | |||
| HASH JOIN | 0 | 3998K | 0 | 00:00:00.01 | 0 | 1517K | 1517K | 993K (0) | |
12 | PX RECEIVE | 0 | 4 | 0 | 00:00:00.01 | 0 | ||||
13 | PX SEND BROADCAST | :TQ10000 | 0 | 4 | 0 | 00:00:00.01 | 0 | |||
14 | PX BLOCK ITERATOR | 0 | 4 | 0 | 00:00:00.01 | 0 | ||||
| TABLE ACCESS FULL | DEPT_NOPARTITION | 0 | 4 | 0 | 00:00:00.01 | 0 | |||
16 | PX BLOCK ITERATOR | 0 | 3998K | 0 | 00:00:00.01 | 0 | ||||
| TABLE ACCESS FULL | EMP_NOPARTITION | 0 | 3998K | 0 | 00:00:00.01 | 0 |
Predicate Information (identified by operation id):
2 - filter(ROWNUM<=40000000)
5 - filter(ROWNUM<=40000000)
6 - access("E"."DEPTNO"="PE"."DEPTNO")
11 - access("D"."DEPTNO"="E"."DEPTNO")
15 - access(:Z>=:Z AND :Z<=:Z)
17 - access(:Z>=:Z AND :Z<=:Z)
{CODE} |