The library total:
SELECT SUM(OBJSIZE) / 1024 / 1024 AS MB
FROM TABLE(QSYS2.OBJECT_STATISTICS('PRODLIB', '*ALL'))
But the total is of little use: what matters is who is taking the space.
SELECT OBJNAME, OBJTYPE,
OBJSIZE / 1024 / 1024 AS MB,
LAST_USED_TIMESTAMP
FROM TABLE(QSYS2.OBJECT_STATISTICS('PRODLIB', '*ALL'))
ORDER BY OBJSIZE DESC
FETCH FIRST 20 ROWS ONLY
The largest libraries on the system, when you do not know where to start:
SELECT OBJNAME AS LIBRARY, OBJSIZE / 1024 / 1024 AS MB
FROM TABLE(QSYS2.OBJECT_STATISTICS('QSYS', '*LIB'))
ORDER BY OBJSIZE DESC
FETCH FIRST 20 ROWS ONLY
Tip
LAST_USED_TIMESTAMP together with size is the pair that actually helps. A large
object used yesterday stays; a large one unused for three years is the first candidate.
Releases. QSYS2.OBJECT_STATISTICS is available from 7.2; on 7.1 it came with a PTF.
The LAST_USED_TIMESTAMP column was added after the function itself: if the query answers
SQL0206 — column not found — drop it and the rest still works.
Comments
No comments yet. Be the first to comment!
You need an account to comment. Log in · Sign up