-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathxplan_test_self.sql
43 lines (29 loc) · 1.22 KB
/
xplan_test_self.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
--------------------------------------------------------------------------------
-- Author: Alberto Dell'Era
-- Copyright: (c) 2008-2021 Alberto Dell'Era http://www.adellera.it
--------------------------------------------------------------------------------
set echo on
set trimspool on
/*
drop table t;
create table t (x int, y int);
create index t_x_idx on t(x);
insert into t(x,y) select rownum, rownum from dual connect by level <= 10000;
commit;
exec dbms_stats.gather_table_stats(user, 'T', cascade=>true, method_opt=>'for all columns size 1', estimate_percent=>null);
*/
--alter system flush shared_pool;
alter system flush buffer_cache;
alter session set statistics_level=all;
select /*+ index(t,t_x_idx) xplan_test_marker */ t.y, (select y from t t2 where t2.x = t.x) from t where x > 0;
select /*+ leading(t2) use_nl(t1,t2) index(t2,t_x_idx) xplan_test_marker */ t1.*, t2.*
from t t1, t t2
where t1.x = t2.x
and t1.y <= 1000;
update /*+ xplan_test_marker */ t set x = x;
rollback;
set autotrace traceonly statistics
insert /*+ append xplan_test_marker */ into t select rownum-1, rownum-1 from dual connect by level <= 100000;
rollback;
set autotrace off
@xplan "%xplan_test_marker%" "ti=n,oi=n,plan_details=y"