Home » RDBMS Server » Server Administration » why avg(newwrites.value-oldwrites.value) is writes
why avg(newwrites.value-oldwrites.value) is writes [message #58452] Wed, 27 August 2003 21:21 Go to next message
Stephen
Messages: 26
Registered: January 2000
Junior Member
Now I read a script:rpt_avg_io_day.sql

The statistic#=41 is "consistent gets".
Why avg(newwrites.value-oldwrites.value) is writes?

thank you!

rpt_avg_io_day.sql
SQL> column reads format 999,999,999
SQL> column writes format 999,999,999
SQL>
SQL> select
2 to_number(to_char(snap_time,'D'))-1,
3 avg(newreads.value-oldreads.value) reads,
4 avg(newwrites.value-oldwrites.value) writes
5 from
6 perfstat.stats$sysstat oldreads,
7 perfstat.stats$sysstat newreads,
8 perfstat.stats$sysstat oldwrites,
9 perfstat.stats$sysstat newwrites,
10 perfstat.stats$snapshot sn
11 where
12 newreads.snap_id = sn.snap_id
13 and
14 newwrites.snap_id = sn.snap_id
15 and
16 oldreads.snap_id = sn.snap_id-1
17 and
18 oldwrites.snap_id = sn.snap_id-1
19 and
20 oldreads.statistic# = 40
21 and
22 newreads.statistic# = 40
23 and
24 oldwrites.statistic# = 41
25 and
26 newwrites.statistic# = 41
27 --and
28 -- sn.snap_time > '2003-07-29'
29 having
30 avg(newreads.value-oldreads.value) > 0
31 and
32 avg(newwrites.value-oldwrites.value) > 0
33 group by
34 to_char(snap_time,'D')
35 order by to_char(snap_time,'D')
36 ;

TO_NUMBER(TO_CHAR(SNAP_TIME,'D'))-1 READS WRITES
----------------------------------- ------------ ------------
0 69,308 40,606,777
1 118,938 67,432,921
2 87,640 68,084,100
3 108,885 69,390,664
4 153,429 62,693,358
5 172,048 71,852,735
6 39,425 49,325,761
Re: why avg(newwrites.value-oldwrites.value) is writes [message #58454 is a reply to message #58452] Wed, 27 August 2003 22:05 Go to previous message
Stephen
Messages: 26
Registered: January 2000
Junior Member
I know why!

Because this script use oracle8i.

My DB is oracle9i.

这人写的书很多地方不严谨,甚至有一些错误。今年写的文章还有不少错误!!!
SQL> select * from v$version;

BANNER
----------------------------------------------------------------
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
PL/SQL Release 9.2.0.1.0 - Production
CORE 9.2.0.1.0 Production
TNS for 32-bit Windows: Version 9.2.0.1.0 - Production
NLSRTL Version 9.2.0.1.0 - Production

SQL> select * from v$sysstat
2 where statistic#=40 or statistic#=41;

STATISTIC# NAME CLASS VALUE
---------- ---------------------------------------------------------------- ---------- ----------
40 db block gets 8 1425184
41 consistent gets 8 2823536

SQL> conn rainy/rainy@18
Connected.
SQL> select * from v$version;

BANNER
----------------------------------------------------------------
Oracle8i Enterprise Edition Release 8.1.7.0.0 - Production
PL/SQL Release 8.1.7.0.0 - Production
CORE 8.1.7.0.0 Production
TNS for 32-bit Windows: Version 8.1.7.0.0 - Production
NLSRTL Version 3.4.1.0.0 - Production

SQL> select * from v$sysstat
2 where statistic#=40 or statistic#=41;

STATISTIC# NAME CLASS VALUE
---------- ---------------------------------------------------------------- ---------- ----------
40 physical reads 8 853
41 db block changes 8 14805

SQL>

__________________
It is hard to love
It is the life

MSN: biti_rainy@hotmail.com
QQ: 3961057

oracle consultant/service

如果您有问题请在论坛上提出
Previous Topic: 50% CPU Usage
Next Topic: duplicate value in SQL statement
Goto Forum:
  


Current Time: Fri Sep 20 07:21:03 CDT 2024