forked from oracle-samples/oracle-db-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathq1.lst
61 lines (51 loc) · 2.09 KB
/
q1.lst
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
SQL> @q1
SQL> set timing on
SQL> --
SQL> -- The adaptive plan feature can potentially avoid performance regressions
SQL> -- associate with the wrong join type being chosen, so we are going to disable it because
SQL> -- we WANT to induce a performance regression for SPM to fix.
SQL> --
SQL>
SQL> select /*+ NO_ADAPTIVE_PLAN */ sum(t1.c), sum(t2.c)
2 from t1, t2
3 where t1.a = t2.a
4 and t1.d = 10;
SUM(T1.C) SUM(T2.C)
---------- ----------
500001 500001
Elapsed: 00:00:00.22
SQL>
SQL> @plan
SQL> set linesize 250
SQL> set trims on
SQL> set tab off
SQL> set tab off
SQL> set pagesize 1000
SQL> column plan_table_output format a180
SQL>
SQL> SELECT *
2 FROM table(DBMS_XPLAN.DISPLAY_CURSOR(FORMAT=>'TYPICAL'));
PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SQL_ID 0ptw8zskuh9r4, child number 2
-------------------------------------
select /*+ NO_ADAPTIVE_PLAN */ sum(t1.c), sum(t2.c) from t1, t2 where
t1.a = t2.a and t1.d = 10
Plan hash value: 906334482
------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time |
------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | | | | 3778 (100)| |
| 1 | SORT AGGREGATE | | 1 | 22 | | | |
|* 2 | HASH JOIN | | 495K| 10M| 11M| 3778 (1)| 00:00:01 |
|* 3 | TABLE ACCESS FULL| T1 | 493K| 6264K| | 1099 (1)| 00:00:01 |
| 4 | TABLE ACCESS FULL| T2 | 1000K| 8789K| | 1095 (1)| 00:00:01 |
------------------------------------------------------------------------------------
Predicate Information (identified by operation id):
---------------------------------------------------
2 - access("T1"."A"="T2"."A")
3 - filter("T1"."D"=10)
23 rows selected.
Elapsed: 00:00:00.46
SQL>
SQL> spool off