用x$dual代替dual所得到的结果是什么

王朝other·作者佚名  2008-05-31
窄屏简体版  字體: |||超大  

connect / as sysdba

create view dual2

as select dummy from x$dual

where instance = USERENV('INSTANCE');

grant select on dual2 to public;

create public synonym dual2 for dual2;

connect scott/tiger;

create table temp

( sqlno number(3),

b_a varchar2(2),

stat number,

value number

);

SQL l

1declare

2v_dummy date;

3v_start number;

4begin

5insert into temp select 1,'b',statistic#,value from v$mystat;

6v_start := dbms_utility.get_time;

7for i in 1..2000 loop

8 select sysdate into v_dummy from dual;

9end loop;

10dbms_output.put_line('1st stat used: '(dbms_utility.get_time - v_start)' seconds');

11

12insert into temp select 1,'ab',statistic#,value from v$mystat;

13v_start := dbms_utility.get_time;

14for i in 1..2000 loop

15 select sysdate into v_dummy from dual2;

16end loop;

17dbms_output.put_line('2st stat used: '(dbms_utility.get_time - v_start)' seconds');

18insert into temp select 2,'a',statistic#,value from v$mystat;

19end;

20*

SQL /

1st stat used: 57 seconds

2st stat used: 45 seconds

PL/SQL procedure sUCcessfully completed.

SQL l

1select (select name from v$statname where statistic# = t2.stat) name, t1.value value1, t2.value value2

2from

3(

4select 1,b.stat,b.value - a.value value

5from

6(select * from temp

7where sqlno=1

8and b_a = 'b') a,

9(select * from temp

10where sqlno=1

11and b_a = 'ab')b

12where b.stat = a.stat

13) t1,

14(select 2,t3.stat,t4.value - t3.value value

15from

16(select * from temp

17where sqlno=1

18and b_a = 'ab') t3,

19(select * from temp

20where sqlno=2

21and b_a = 'a')t4

22where t4.stat = t3.stat

23) t2

24where t1.stat = t2.stat

25* and t1.value <t2.value

SQL /

NAME VALUE1 VALUE2

---------------------------------------- ---------- ----------

session logical reads 10016 20

enqueue releases12

db block gets8011 15

consistent gets20055

db block changes8 18

free buffer requested 12

calls to kcmgcs 02

calls to get snapshot scn: kcmgss2004 2002

redo entries5 11

redo size5124 5928

no work - consistent read gets 20022

table scans (short tables) 20000

table scan rows gotten 20000

table scan blocks gotten 20000

buffer is not pinned count 20044

15 rows selected.

right"(出处:清风软件下载学院)

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航