job_name | num_times_run | avg_time_seconds | max_time_seconds |
---|---|---|---|
AllocateBudget | 45 | 25 | 50 |
AllocateForecast | 15 | 28 | 32 |
Oracle:
select job_name, count(job_name) as num_times_run, round(avg(abs(extract(second from elapsed) + extract(minute from elapsed)*60 + extract(hour from elapsed)*60*60 + extract(day from elapsed)*24*60*60)),0) as avg_time_seconds, round(max(abs(extract(second from elapsed) + extract(minute from elapsed)*60 + extract(hour from elapsed)*60*60 + extract(day from elapsed)*24*60*60)),0) as max_time_seconds from ( select user_id, job_name, start_time, end_time, (end_time - start_time) elapsed; from hsp_job_status where parent_job_id is null and end_time is not null and start_time > to_char(sysdate-7) ) group by job_name order by num_times_run desc
SQL Server:
select job_name, count(job_name) as num_times_run, round(avg(abs(DATEPART(second, elapsed) + datepart(minute, elapsed) + datepart(hour, elapsed) + datepart(day, elapsed))),0) as avg_time_seconds, round(max(abs(DATEPART(second, elapsed) + DATEPART(minute, elapsed) + DATEPART(hour, elapsed) + DATEPART(DAY, elapsed))),0) as max_time_seconds from ( select user_id, job_name, start_time, end_time, datediff(ss,start_time,END_TIME) as elapsed from [dbo].[HSP_JOB_STATUS] where parent_job_id is null and end_time is not null and start_time > GETDATE()-7 ) as ps group by job_name order by num_times_run desc
No comments:
Post a Comment