Monitoring performance with SQL -Lock wait time Appl
query to report on the lock wait statistics of currently connected applications.
db2 "select substr(ai.appl_name,1,20) as appl_name , \ substr(ai.primary_auth_id,1,10) as auth_id , ap.agent_id as app_handle,\ ap.lock_waits as lock_waits, ap.lock_wait_time / 1000 as Total_Wait_S, \ (ap.lock_wait_time / ap.lock_waits ) as Avg_Wait_ms \ from sysibmadm.snapappl_info ai, sysibmadm.snapappl ap \ where ai.agent_id = ap.agent_id and ap.lock_waits > 0"
APPL_NAME AUTH_ID APPL_HANDLE LOCK_WAITS TOTAL_WAIT_S AVG_WAIT_MS
-------------------- ---------- --- ------------------------ - --------------- -------------------- --------------------
pmrepagent INFOD 356 3 0 0
pmrepagent INFOD 537 5 0 2
pmrepagent INFOD 739 10 0 6
pmrepagent INFOD 456 13 0 2
pmrepagent INFOD 108 16 0 3
pmrepagent INFOD 215 14 0 4
pmrepagent INFOD 793 12 0 2
pmrepagent INFOD 141 11 0 4
pmrepagent INFOD 314 27 1 53
If an application is either waiting on locks very frequently or the total wait time is very high (which
may indicate a single very long wait), you should drill down more on the application (show
the statement) and look at the lock chains to see which application is the holder of the locks
that this application is waiting on. Changing the application that is holding the lock to
Commit more frequently may solve the lock wait problems