|
| 1 | +SQL> @q2 |
| 2 | +SQL> select /*+ LEADING(t1 t2) USE_NL(t2) */ |
| 3 | + 2 sum(t1.num), sum(t2.num) |
| 4 | + 3 from table1 t1 |
| 5 | + 4 join table2 t2 on (t1.id = t2.id); |
| 6 | + |
| 7 | +SUM(T1.NUM) SUM(T2.NUM) |
| 8 | +----------- ----------- |
| 9 | + 1 10 |
| 10 | + |
| 11 | +SQL> |
| 12 | +SQL> @plan |
| 13 | +SQL> set linesize 200 |
| 14 | +SQL> set tab off |
| 15 | +SQL> set pagesize 1000 |
| 16 | +SQL> column plan_table_output format a180 |
| 17 | +SQL> |
| 18 | +SQL> SELECT * |
| 19 | + 2 FROM table(DBMS_XPLAN.DISPLAY_CURSOR(FORMAT=>'TYPICAL')); |
| 20 | + |
| 21 | +PLAN_TABLE_OUTPUT |
| 22 | +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| 23 | +SQL_ID 1c899cktncv5m, child number 0 |
| 24 | +------------------------------------- |
| 25 | +select /*+ LEADING(t1 t2) USE_NL(t2) */ sum(t1.num), sum(t2.num) |
| 26 | +from table1 t1 join table2 t2 on (t1.id = t2.id) |
| 27 | + |
| 28 | +Plan hash value: 339338377 |
| 29 | + |
| 30 | +--------------------------------------------------------------------------------------------------- |
| 31 | +| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | |
| 32 | +--------------------------------------------------------------------------------------------------- |
| 33 | +| 0 | SELECT STATEMENT | | | | 4 (100)| | |
| 34 | +| 1 | RESULT CACHE | 86m6ud7jmfq443pumuj63z1bmd | | | | | |
| 35 | +| 2 | SORT AGGREGATE | | 1 | 52 | | | |
| 36 | +|* 3 | HASH JOIN | | 1 | 52 | 4 (0)| 00:00:01 | |
| 37 | +| 4 | TABLE ACCESS FULL| TABLE2 | 1 | 26 | 2 (0)| 00:00:01 | |
| 38 | +| 5 | TABLE ACCESS FULL| TABLE1 | 1000 | 26000 | 2 (0)| 00:00:01 | |
| 39 | +--------------------------------------------------------------------------------------------------- |
| 40 | + |
| 41 | +Predicate Information (identified by operation id): |
| 42 | +--------------------------------------------------- |
| 43 | + |
| 44 | + 3 - access("T1"."ID"="T2"."ID") |
| 45 | + |
| 46 | +Result Cache Information (identified by operation id): |
| 47 | +------------------------------------------------------ |
| 48 | + |
| 49 | + 1 - |
| 50 | + |
| 51 | +Note |
| 52 | +----- |
| 53 | + - dynamic statistics used: dynamic sampling (level=2) |
| 54 | + - automatic DOP: Computed Degree of Parallelism is 1 because of no expensive parallel operation |
| 55 | + |
| 56 | + |
| 57 | +33 rows selected. |
| 58 | + |
| 59 | +SQL> |
| 60 | +SQL> spool off |
0 commit comments