A DB2 thread is one agent doing SQL: a CICS task, a batch job, a DBAT from DDF. Monitoring that thread means reading the Instrumentation Facility numbers —CPU, elapsed, getpages, buffer pool reads, synchronous I/O, lock wait, deadlocks, timeouts, and sort — and knowing which class they come from. This page is the field guide for those metrics.
Accounting IFCID 3 is the thread’s scorecard. It is written when the thread ends, is reused, the authorization ID changes, or a DDF accounting interval closes. IFCID 239 repeats much of the story per package when accounting classes 7, 8, and 10 are on — that is how you see that the time is in package PAYROLL.FETCH not in the caller.
Identify the thread first: CONNID (CICS, TSO, UTILITY, SERVER), CORRID (CICS transid or job name), AUTHID, PLAN, LUWID/TOKEN. DISPLAY THREAD is the live list; accounting is the history for that identity.
| Metric | Meaning |
|---|---|
| Class 1 elapsed / CPU | Whole accounting interval, including application |
| Class 2 elapsed / CPU | Time and CPU inside Db2 |
| Class 3 waits | Why class 2 elapsed exceeded class 2 CPU |
| Getpages | Buffer manager page requests (logical I/O) |
| Sync reads | Getpages that waited on a random read I/O |
| Lock wait | Time waiting for locks or IRLM |
Elapsed is wall-clock. CPU is processor time (TCB plus, where reported, SRB / specialty engines — read your monitor’s labels). Accounting classes split the story:
Classic patterns:
On zIIP-eligible work (DDF, parallelism, some utilities), CPU may show on specialty engines. Elapsed can still be terrible if the thread waits on I/O even when general CP looks idle.
A getpage is a request for a page from the buffer manager. It is the best single “how hard did this SQL hit the data” counter. It is not a disk I/O.
Buffer pool hit ratio for a thread ≈ 1 − (sync reads / getpages). A scan can have an excellent prefetch hit ratio and still burn elapsed. Do not celebrate a 99 percent hit ratio on a query that did 50 million getpages — it still did 50 million getpages. Compare getpages per commit or per SQL call to a baseline.
Class 3 synchronous I/O wait is elapsed spent in those random reads (and related sync writes). If this bucket owns the elapsed time:
Prefetch wait is a different class 3 bucket: the scan ran faster than the I/O. That is a sequential problem, not “missing index” in the same way.
Lock wait (class 3) is time waiting for a lock or often IRLM latch. Causes: long URs (missing COMMIT), tablespace locks, lock escalation, index hot spots on monotonically increasing keys, claim/drain behind a utility.
Deadlock (IFCID 172) is a cycle: A waits for B, B waits for A. Victim usually gets SQLCODE -911 and rollback. Timeout (IFCID 196) is waiting longer than IRLMRWT: -911 if rolled back, -913 if not. Monitoring: spikes in these IFCIDs in statistics class 3, plus accounting lock-wait for the surviving threads. DISPLAY BLOCKERS shows who holds the lock now; SMF tells you who waited then.
Accounting reports sorts performed, sort elapsed, and often whether work files were used. Sorts come from ORDER BY without a supporting index, GROUP BY, DISTINCT, merge join, nested loop with sort, and some subquery rewrites. A sudden sort after a rebind means the optimizer dropped an index order. Work-file (DSNDB07) explosion shows up as this thread’s sort plus statistics for the work-file buffer pool. Do not confuse a “sort” in EXPLAIN with zero sort in accounting — some sorts are avoided at run time.
Allied threads (CICS, IMS, TSO, batch) map cleanly to a connection. DDF is messier:
Accounting for a reused DBAT may cover many client units of work depending on CMTSTAT and accounting intervals. If one SERVER thread shows 10 minutes of CPU, it might be one monster SQL or a hundred small ones. Package-level 239 and the dynamic cache break that apart. DISPLAY DDF counts connections versus active DBATs versus MAXDBAT — when MAXDBAT is hit, new work queues and class 1 elapsed on the client explodes before class 2 on the DBAT even starts.
123-DISPLAY THREAD(*) DETAIL -DISPLAY BLOCKERS -DISPLAY BUFFERPOOL(BP2) DETAIL
A thread is one kid doing a worksheet. Elapsed time is how long until they hand it in. CPU is how long their pencil was actually moving. Getpages are how many times they asked for a piece of paper from the shared drawer (the buffer pool). Synchronous I/O is walking to the cupboard because the drawer was empty. Lock wait is standing behind another kid who will not share the red crayon. A deadlock is two kids each holding the crayon the other needs. A timeout is giving up after waiting too long. A sort is dumping all the papers on the floor and putting them in order. Class 1 includes walking to the classroom; class 2 is only time at the desk.
1. Class 1 elapsed time includes:
2. A getpage is:
3. High class 3 lock wait with low class 2 CPU usually means:
4. Deadlock versus timeout in monitoring:
5. Sort activity in accounting tells you: