zOs/SQL/PDBGENMF

set current path oa1p;
select *
    from       rz2XX.TACCT_GENERAL g
    where --timestamp > current timestamp - 3 day
            plan_Name =    'MF7270'
    order by timestamp desc
    fetch first 100 rows only
;;;
with g as
(
  select date(timestamp) g1,
       case when timestamp between '2000-05-19-11.00.00'
                               and '2000-05-19-12.30.00' then 'x'
            else ' ' end g2,
       g.*
    from       TACCT_GENERAL g
    where not    timestamp between '2010-05-19-12.30.00'
                               and '2010-05-19-13.00.00'
)
select min(timestamp - class1_elapsed seconds) "von",
       time(max(timestamp)) "bis",
       fosFmte7(sum(occurrences)) occ,
       fosFmte7(sum(class1_elapsed)) "ela sec",
       fosFmte7(sum(class1_cpu_total)) "tot cpu",
       fosFmte7(sum(class2_cpu_total)) "db2 cpu",
       fosFmte7(sum(CLASS3_LOCK_LATCH)) "lockLat",
       fosFmte7(sum(CLASS3_SYNC_IO)) "syncIo",
       fosFmte7(sum(CLASS3_GLOBAL_CONT)) "gloCon",
       oa1p.fosFmtE7(sum(select)) "select",
       oa1p.fosFmtE7(sum(open)) "open",
       oa1p.fosFmtE7(sum(fetch)) "fetch",
       oa1p.fosFmtE7(sum(commit)) "commit",
       oa1p.fosFmtE7(sum(insert)) "insert",
       oa1p.fosFmtE7(sum(update)) "update",
       oa1p.fosFmtE7(sum(delete)) "delete",
       oa1p.fosFmtE7(sum(class2_elapsed)/sum(insert+update)) "ela/i+u" ,
       fosFmte7(sum(class2_cpu_total) / sum(insert+update)) "cpu/i+u",
       fosFmte7(sum(CLASS3_LOCK_LATCH)/sum(insert+update)) "LocLat/i+u",
       fosFmte7(sum(CLASS3_SYNC_IO)/sum(insert+update)) "syncIo/i+u",
       count(distinct subsystem_id) "#ssid",
       plan_name,
       min(connect_id) || '-' || max(connect_id) "connectionId"
    from g
    where timestamp > current timestamp - 666 days
      --  and connect_ID like 'NI229%'
          and plan_name in ( 'MF8500', 'MF7230', 'MF7310')
          and (plan_name <> 'MF8500' or connect_id like 'MFT56%')
      --  and insert >= 1
      group by g1, g2, plan_name, left(connect_Id, 5)
      having sum(insert+update) > 0
      order by plan_Name, 1 desc
    with ur
;
X;
select *
    from       rz2dd.TACCT_GENERAL g
    where timestamp > current timestamp - 2 day
           and plan_Name like 'MF%'
    order by timestamp desc
    fetch first 100 rows only
;;;
set current schema = RZ2MM;
select dayofWeek(timestamp), class1_elapsed, class2_elapsed,
       fosFmte7(occurrences) occ,
       fosFmtE7(   (select)) sel,
       fosFmtE7(   (insert)) ins,
                    update   upd,
       g.*
    from       TACCT_GENERAL g
    where      plan_name = 'MF7800'
         and timestamp between '2010-12-19-00.00.00'
                       and     '2010-12-20-00.00.00'
    order by timestamp desc
    with ur
;  x
select *
    from       TACCT_GENERAL g
    where      timestamp > current timestamp - 3  days
      and (    corrName like 'MFT15%'
            or corrName like 'MFT18%'
            or corrName like 'MFT56%'
            or connect_id like  'MFT56%'
            or corrName =    'MFT3100P'
          )
    order by timestamp desc
    with ur
;
x;
set current path oa1p;
set current schema = RR2HH;
select *
    from       TACCT_GENERAL g
    where      timestamp > current timestamp - 5  days
      and      corrName = 'YMFNVLOH'
    order by timestamp desc
    with ur
;
x;
select timestamp - class1_elapsed seconds "von",
       timestamp "bis",
       g.*
    from       TACCT_GENERAL g
    where -- timestamp > current timestamp - 2  days
              (corrName like 'A895326%' or corrName like 'MF%')
      --  and connect_ID like 'NI229%'
          and plan_name like 'MF%'
          and subsystem_id like 'DZF%'
      --  and insert >= 1
      order by timestamp    desc
    with ur
;x;
select subsystem_id, count(*), min(timestamp), max(timestamp)
    from       TACCT_GENERAL g
    where timestamp >=      '2010-07-27-00.00.00'
    group by subsystem_id
;x;
select min(timestamp), max(timestamp)
    from       TACCT_GENERAL g
;x;
xet current path oa1p;
set current schema = RZ2DD;
select date(timestamp),
       fosFmte7(sum(occurrences)) occ,
       oa1p.fosFmtE7(sum(select)) sel,
       oa1p.fosFmtE7(sum(insert)) ins,
       oa1p.fosFmtE7(sum(update)) upd,
       oa1p.fosFmtE7(sum(delete)) del,
       oa1p.fosFmtE7(sum(class2_elapsed)/sum(insert+update)) "ela/i+u" ,
       fosFmte7(sum(class2_cpu_total) / sum(insert+update)) "cpu/i+u",
       fosFmte7(sum(CLASS3_LOCK_LATCH)/sum(insert+update)) "LocLat/i+u",
       fosFmte7(sum(CLASS3_SYNC_IO)/sum(insert+update)) "syncIo/i+u"
    from RZ2dd.TACCT_GENERAL g
    where timestamp > current timestamp - 1 month
      --  and connect_ID like 'NI229%'
          and plan_name = 'NI5340'
      --  and insert >= 1
    group by timestamp
    ORDER BY Timestamp desc
    with ur
;
X
select plan_name,
       fosFmte7(sum(occurrences)) occ,
       oa1p.fosFmtE7(sum(select)) sel,
       oa1p.fosFmtE7(sum(insert)) ins,
       oa1p.fosFmtE7(sum(update)) upd,
       oa1p.fosFmtE7(sum(delete)) del,
       min(timestamp), max(timestamp)
    from       TACCT_GENERAL g
    where timestamp > '2010-03-21-00.30.00.000'
      and timestamp < '2010-03-21-02.30.00.000'
      --  and connect_ID like 'NI229%'
      --  and plan_name = 'NI5340'
      --  and insert >= 1
    group by plan_name
    order by sum(select+insert+update+delete) desc
    with ur
;
X
select sum(select) sel , sum(insert) ins, sum(update) upd,
       sum(class2_elapsed) / sum(insert) "ela/ins" ,
       sum(class2_cpu_total) / sum(insert) "cpu/ins",
       sum(LOCK_LATCH_SUSP),
       sum(CLASS3_LOCK_LATCH)/sum(insert) "LocLat/ins",
       sum(SYNC_IO_SUSP),
       sum(CLASS3_SYNC_IO)/sum(insert) "syncIo/ins",
       sum(occurrences)  occ,
       timestamp
    from RZ2hh.TACCT_GENERAL g
    where timestamp > current timestamp - 2 DAY
      --  and connect_ID like 'NI229%'
          and plan_name = 'NI5340'
      --  and insert >= 1
    ORDER BY Timestamp desc
    with ur
;
X
select subsystem_id, count(*), min(timestamp), max(timestamp)
    from RR2HH.TACCT_GENERAL g
 -- where corrName like 'NI%'
    group by subsystem_id
    order by subsystem_id
    with ur
;
xelect class2_elapsed,
    smallInt(1000* class2_cpu_total     /class2_elapsed) cpu,
    smallInt(1000* class3_global_cont  /class2_elapsed) "gloCon",
    smallInt(1000* class3_DB_IO        /class2_elapsed) "db io",
    smallInt(1000* class3_LOG_WRT_IO   /class2_elapsed) "logIO",
    smallInt(1000* (class2_cpu_total
                 + class3_global_cont
                 + class3_DB_IO
                 + class3_LOG_WRT_IO ) /class2_elapsed) "sum",
        g.*
    from RR2HH.TACCT_GENERAL g
    where -- timestamp > current timestamp - 120 DAY
              corrname like 'NI229%'
 --        or corrname like 'NI22922%'
   --     and plan_name like 'DSNUT%'
   --     and insert >= 1
    ORDER BY CLASS1_ELAPSED desc
;
X
select class2_elapsed / insert , class2_su_cpu / insert,
        g.*
    from RZ2XX.TACCT_GENERAL g
--  where timestamp > current timestamp - 1 month
    where timestamp IN ('2010-02-02-01.05.50.881483'
                       ,'2010-01-30-06.38.00.929757')
          and plan_name = 'BE5020'
          and  insert > 500000 -- class2_elapsed >= 1000
    order by 1 desc, class2_elapsed desc
;
select -- class2_elapsed / insert , class2_su_cpu / insert,
        g.*
    from RZ2XX.TACCT_GENERAL g
    where timestamp > current timestamp - 5 DAY
          and plan_name = 'RB5000'
    ORDER BY Timestamp asc
;
X