Report CPU usage over 24 Hours
/* SQL to report CPU usage over 24 Hour period */
/* Make sure the collectintervals set correct */
select TheDate,
cast((cast((TheTime (format '99:99:99')) as char(8))) as time(0)) as TheTime,
(sum(CPUIdle) / TOTAL_CPU) * 100 AS CPUIdle,
(sum(CPUIoWait) / TOTAL_CPU) * 100 AS CPUIoWait,
(sum(CPUUServ) / TOTAL_CPU) * 100 AS CPUUServ,
(sum(CPUUExec) / TOTAL_CPU) * 100 AS CPUUExec,
SUM(CPUIdle + CPUIoWait + CPUUServ + CPUUExec) AS TOTAL_CPU,
(avg(CPUUServ + CPUUExec) / max(CPUUServ + CPUUExec)) * 100 AS CPUBusyParallelEff
from dbc.resusagespma
where thedate >= date - 1 and
collectintervals = '10'
group by 1,2
order by 1,2
;
/* Make sure the collectintervals set correct */
select TheDate,
cast((cast((TheTime (format '99:99:99')) as char(8))) as time(0)) as TheTime,
(sum(CPUIdle) / TOTAL_CPU) * 100 AS CPUIdle,
(sum(CPUIoWait) / TOTAL_CPU) * 100 AS CPUIoWait,
(sum(CPUUServ) / TOTAL_CPU) * 100 AS CPUUServ,
(sum(CPUUExec) / TOTAL_CPU) * 100 AS CPUUExec,
SUM(CPUIdle + CPUIoWait + CPUUServ + CPUUExec) AS TOTAL_CPU,
(avg(CPUUServ + CPUUExec) / max(CPUUServ + CPUUExec)) * 100 AS CPUBusyParallelEff
from dbc.resusagespma
where thedate >= date - 1 and
collectintervals = '10'
group by 1,2
order by 1,2
;
Labels: cpu, IO, optimisation, performance, report, teradata
3 Comments:
ResUsageSpam logs CPU time in centiseconds. Don't you think, it is better to calculate TotalCPU in seconds instead of centiseconds?
Hi Ranjith,
Can I get SQL for How I can find
Database growth.
Hi Ranjith,
Can I get SQL for How I can find
Database growth.
Post a Comment
Subscribe to Post Comments [Atom]
<< Home