Re: Time Series Format of Operating System Statistics

select
   to_char(s.end_interval_time,'DD-MON-YYYY HH24:MI') SNAP_TIME,
   os.stat_name,
   os.value,
   lag(os.value,1) over (PARTITION BY os.STAT_NAME order by os.snap_id)
prev,
   case
   when os.stat_name = 'LOAD'                 then os.value
   when os.stat_name = 'PHYSICAL_MEMORY_BYTES' then os.value
   else os.value - lag(os.value,1) over (PARTITION BY os.STAT_NAME order by
os.snap_id)
   end value
from
  dba_hist_snapshot s,
  dba_hist_osstat os
where
s.snap_id = os.snap_id
order by os.snap_id,os.stat_name
;

seems to give what you want to me. I'd probably not query the "fixed" values
myself.

cheers

Niall



On Sat, Jan 30, 2010 at 7:01 AM, Karl Arao <karlarao@xxxxxxxxx> wrote:

> If you have another way of writing the query... just reply here together
> with the output ...
>
>
> - Karl Arao
> karlarao.wordpress.com
>
>


-- 
Niall Litchfield
Oracle DBA
http://www.orawin.info

Other related posts: