-- AWR SQL Stat History 확인
with w_sqlstat as (
select /*+ inline use_nl(a,b,c) leading(a) index(a (sql_id))*/
a.*,
to_char(b.begin_interval_time,'mm/dd hh24:mi') snap_time
from dba_hist_sqlstat a
, dba_hist_snapshot b
where b.dbid = a.dbid
and b.instance_number = a.instance_number
and b.snap_id = a.snap_id
and a.sql_id = '7s4bffkwdq1r4'
-- and a.module like 'BTmapsc090%'
-- and b.instance_number = 1
-- and b.dbid = 3107085369
-- and a.snap_id >= 15817
--and b.snap_id = 55925
--and b.snap_id between 995015 and 99558
--and b.snap_id = 36004
--and to_char(b.begin_interval_time,'yyyymmddhh24') >= '2009060809'
--and to_char(b.end_interval_time,'yyyymmddhh24') <= '2009010522'
--and a.module <> 'pfmBatch'
--and a.parsing_schema_name = 'HDEGS'
)
select
a.instance_number inst#,
a.snap_id,
-- a.dbid,
a.module module,
a.action action,
-- a.parsing_schema_name schema,
a.sql_id,
a.snap_time,
a.plan_hash_value plan_hash_value,
-- round( (a.cpu_time_delta / (sum(cpu_time_delta) over ()) ) * 100, 2) cpu_pct,
a.executions_delta executions,
round(a.elapsed_time_delta / decode(a.executions_delta,0,1,a.executions_delta) / 1000000, 6) el_per,
round(a.apwait_delta / decode(a.executions_delta,0,1,a.executions_delta) / 1000000, 6) apw_per,
round(a.clwait_delta / decode(a.executions_delta,0,1,a.executions_delta) / 1000000, 6) clw_per,
round(a.buffer_gets_delta / decode(a.executions_delta,0,1,a.executions_delta)) bg_per,
round(a.rows_processed_delta / decode(a.executions_delta,0,1,a.executions_delta)) rows_per,
round(a.elapsed_time_delta / 1000000, 6) elapsed_time,
round(a.cpu_time_delta / 1000000, 6) cpu_time,
round(a.iowait_delta / 1000000, 6) iowait,
round(a.clwait_delta / 1000000, 6) clwait,
round(a.apwait_delta / 1000000, 6) apwait,
round(a.ccwait_delta / 1000000, 6) ccwait,
a.parse_calls_delta parse_calls,
a.disk_reads_delta disk_reads,
a.buffer_gets_delta buffer_gets,
a.rows_processed_delta rows_processed,
a.sorts_delta sorts,
a.fetches_delta fetches
from w_sqlstat a
order by a.snap_id desc
;
댓글
댓글 쓰기