zOs/SQL/GBGRREO2
-- index space und Details für 1 StichDatum
set current path oa1p;
with i2 as
(
select rz, dbSys, dbName, ts, indexSpace, instance, partition
, max(loadTs) loadTs
from oa1p.tqz007GbGrIxSTats
where rz = 'RZ2' and dbSys = 'DBOF'
and dbName = 'MF01A1P' and ts = 'A150A'
-- and partition = 507
group by rz, dbSys, dbName, ts, indexSpace, instance, partition
, reorgLastTime, rebuildLastTime
)
, i as
(
select r.*
from i2
join oa1p.tqz007GbGrIxSTats r
on i2.loadTS is not null and r.state <> 'd'
and i2.rz = r.rz
and i2.dbSys = r.dbSys
and i2.dbName = r.dbName
and i2.ts = r.ts
and i2.indexSpace= r.indexSpace
and i2.instance = r.instance
and i2.partition = r.partition
and i2.loadTs = r.loadTS
)
select rz, dbSys, dbName, ts, indexSpace
, substr(tsTy
|| case when tsClone = 'N' and instance=1 and tsInst=1 then ''
else case when instance=tsInst then 'b' else 'c' end
|| instance end, 1, 3) "yci"
, substr(case when partition = 0 and tsParts = 0 then ''
else case when partition is null then ' ---'
when partition = 0 then ' npi'
when partition = 0 and tsTy = 'G' then ' pbg'
when partition = 0 then ' ???'
else right(' ' || partition, 4)
end
||'/'|| value(right(' '|| tsParts, 4),'----')
end, 1, 9) "part/ tot"
-- , smallInt(partition) part
, substr(fosFmte7(real(nActive) * ixPgSz * 1024), 1, 7) used
, substr(fosFmte7(totalEntries), 1, 7) rows
, substr(name, 1, 30) "index"
, updateStatsTime, i.*
from i
order by rz, dbSys, dbName, ts, indexSpace, instance, partition
, loadTs desc
;