/
demo4.sql
131 lines (122 loc) · 1.53 KB
/
demo4.sql
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
-- Copyright 2018 Tanel Poder. All rights reserved. More info at http://tanelpoder.com
-- Licensed under the Apache License, Version 2.0. See LICENSE.txt for terms & conditions.
--------------------------------------------------------------------------------
--
-- File name: demo4.sql
--
-- Purpose: Advanced Oracle Troubleshooting Seminar demo script
-- Causes optimizer to loop in CBO code for very long time
--
-- Author: Tanel Poder ( http://www.tanelpoder.com )
-- Copyright: (c) Tanel Poder
--
--------------------------------------------------------------------------------
prompt Starting demo4...
set termout off feedback off
drop table t;
create table t as select * from all_objects where 1=0;
exec dbms_stats.gather_table_stats(user,'T');
alter session set "_optimizer_search_limit"=100;
select *
from
t t1
,t t2
,t t3
,t t4
,t t5
,t t6
,t t7
,t t8
,t t9
,t t10
,t t11
,t t12
,t t13
,t t14
,t t15
,t t16
,t t17
,t t18
,t t19
,t t20
,t t21
,t t22
,t t23
,t t24
,t t25
,t t26
,t t27
,t t28
,t t29
,t t30
,t t31
,t t32
,t t33
,t t34
,t t35
,t t36
,t t37
,t t38
,t t39
,t t40
,t t41
,t t42
,t t43
,t t44
,t t45
,t t46
,t t47
,t t48
,t t49
,t t50
,t t51
,t t52
,t t53
,t t54
,t t55
,t t56
,t t57
,t t58
,t t59
,t t60
,t t61
,t t62
,t t63
,t t64
,t t65
,t t66
,t t67
,t t68
,t t69
,t t70
,t t71
,t t72
,t t73
,t t74
,t t75
,t t76
,t t77
,t t78
,t t79
,t t80
,t t81
,t t82
,t t83
,t t84
,t t85
,t t86
,t t87
,t t88
,t t89
,t t90
,t t91
,t t92
,t t93
,t t94
,t t95
,t t96
,t t97
,t t98
,t t99
/
set termout on feedback on