Below script just queries DBA_HIST_SQLSTAT for a given sql_id. A sql_id corresponds to a single SQL query.
set linesize 32000
set pagesize 1000
set long 2000000000
set longchunksize 1000
select ss.sql_id,
ss.plan_hash_value,
sn.END_INTERVAL_TIME,
ss.executions_delta,
ELAPSED_TIME_DELTA/(executions_delta*1000) "Elapsed Average ms",
CPU_TIME_DELTA/(executions_delta*1000) "CPU Average ms",
IOWAIT_DELTA/(executions_delta*1000) "IO Average ms",
CLWAIT_DELTA/(executions_delta*1000) "Cluster Average ms",
APWAIT_DELTA/(executions_delta*1000) "Application Average ms",
CCWAIT_DELTA/(executions_delta*1000) "Concurrency Average ms",
BUFFER_GETS_DELTA/executions_delta "Average buffer gets",
DISK_READS_DELTA/executions_delta "Average disk reads",
ROWS_PROCESSED_DELTA/executions_delta "Average rows processed"
from DBA_HIST_SQLSTAT ss,DBA_HIST_SNAPSHOT sn
where ss.sql_id = 'bjxwm53smzfjn'
and ss.snap_id=sn.snap_id
and executions_delta > 0
and ss.INSTANCE_NUMBER=sn.INSTANCE_NUMBER
order by ss.snap_id,ss.sql_id;
SQL_ID PLAN_HASH_VALUE END_INTERVAL_TIME EXECUTIONS_DELTA Elapsed Average ms CPU Average ms IO Average ms Cluster Average ms Application Average ms Concurrency Average ms Average buffer gets Average disk reads Average rows processed
------------- --------------- ------------------------- ---------------- ------------------ -------------- ------------- ------------------ ---------------------- ---------------------- ------------------- ------------------ ----------------------
bjxwm53smzfjn 3241932711 21-NOV-13 11.06.17.602 PM 2603 11457.6083 1242.76082 8398.43699 0 0 18.4320926 101602.754 5548.3227 24.2708413
bjxwm53smzfjn 3241932711 22-NOV-13 12.00.43.481 AM 1430 38261.3023 1765.16249 10753.5862 0 0 178.180512 140427.258 6062.37692 16.3657343
bjxwm53smzfjn 3241932711 22-NOV-13 01.00.08.144 AM 1559 62753.3383 1648.73349 18714.1897 0 0 503.047884 114864.889 5246.56062 23.0667094
bjxwm53smzfjn 3241932711 22-NOV-13 02.00.39.527 AM 1997 51748.324 1763.35454 29884.9149 0 0 108.84675 103847.485 16511.4447 25.897346
bjxwm53smzfjn 3241932711 22-NOV-13 03.00.41.453 AM 9911 5908.77018 1121.02559 4629.14669 0 0 64.4795458 91980.3728 195.806881 7.65533246
bjxwm53smzfjn 3241932711 22-NOV-13 04.00.43.330 AM 7690 12101.7682 1191.67764 10476.0536 0 0 170.186179 92665.0322 370.703771 7.87412224
In general If the number of executions for one week over the next were different that would indicate a change in query volume. If the per execution times were different that would indicate a change in the way each query ran.
set linesize 32000
set pagesize 1000
set long 2000000000
set longchunksize 1000
select ss.sql_id,
ss.plan_hash_value,
sn.END_INTERVAL_TIME,
ss.executions_delta,
ELAPSED_TIME_DELTA/(executions_delta*1000) "Elapsed Average ms",
CPU_TIME_DELTA/(executions_delta*1000) "CPU Average ms",
IOWAIT_DELTA/(executions_delta*1000) "IO Average ms",
CLWAIT_DELTA/(executions_delta*1000) "Cluster Average ms",
APWAIT_DELTA/(executions_delta*1000) "Application Average ms",
CCWAIT_DELTA/(executions_delta*1000) "Concurrency Average ms",
BUFFER_GETS_DELTA/executions_delta "Average buffer gets",
DISK_READS_DELTA/executions_delta "Average disk reads",
ROWS_PROCESSED_DELTA/executions_delta "Average rows processed"
from DBA_HIST_SQLSTAT ss,DBA_HIST_SNAPSHOT sn
where ss.sql_id = 'bjxwm53smzfjn'
and ss.snap_id=sn.snap_id
and executions_delta > 0
and ss.INSTANCE_NUMBER=sn.INSTANCE_NUMBER
order by ss.snap_id,ss.sql_id;
SQL_ID PLAN_HASH_VALUE END_INTERVAL_TIME EXECUTIONS_DELTA Elapsed Average ms CPU Average ms IO Average ms Cluster Average ms Application Average ms Concurrency Average ms Average buffer gets Average disk reads Average rows processed
------------- --------------- ------------------------- ---------------- ------------------ -------------- ------------- ------------------ ---------------------- ---------------------- ------------------- ------------------ ----------------------
bjxwm53smzfjn 3241932711 21-NOV-13 11.06.17.602 PM 2603 11457.6083 1242.76082 8398.43699 0 0 18.4320926 101602.754 5548.3227 24.2708413
bjxwm53smzfjn 3241932711 22-NOV-13 12.00.43.481 AM 1430 38261.3023 1765.16249 10753.5862 0 0 178.180512 140427.258 6062.37692 16.3657343
bjxwm53smzfjn 3241932711 22-NOV-13 01.00.08.144 AM 1559 62753.3383 1648.73349 18714.1897 0 0 503.047884 114864.889 5246.56062 23.0667094
bjxwm53smzfjn 3241932711 22-NOV-13 02.00.39.527 AM 1997 51748.324 1763.35454 29884.9149 0 0 108.84675 103847.485 16511.4447 25.897346
bjxwm53smzfjn 3241932711 22-NOV-13 03.00.41.453 AM 9911 5908.77018 1121.02559 4629.14669 0 0 64.4795458 91980.3728 195.806881 7.65533246
bjxwm53smzfjn 3241932711 22-NOV-13 04.00.43.330 AM 7690 12101.7682 1191.67764 10476.0536 0 0 170.186179 92665.0322 370.703771 7.87412224
In general If the number of executions for one week over the next were different that would indicate a change in query volume. If the per execution times were different that would indicate a change in the way each query ran.
No comments:
Post a Comment