Investigating queuing caused by hard resource entitlements
Queries are queued when there are no available resources to admit additional work. When a service class has a hard resource entitlement, queries that run in that service class are queued to prevent the resource usage in that service class from exceeding its entitlement. Consequently, queries can be queued even when there is spare capacity available for the database, because the resource usage for work in the service class has been explicitly constrained.
The MON_GET_SERIVCE_SUPERCLASS_STATS table function can be used to view the current resource entitlement for each service class as well as the entitlement type (hard or soft). The MON_GET_SERVICE_SUPERCLASS table function can be used to view the current demand for each resource controlled by the adaptive workload manager.
SELECT SUBSTR(T.SERVICE_SUPERCLASS_NAME, 1, 30) AS SERVICE_CLASS,
MAX(DEC(RESOURCE_ENTITLEMENT, 5, 2)) AS RESOURCE_ENTITLEMENT,
MAX(RESOURCE_SHARE_TYPE) AS ENTITLEMENT_TYPE,
MAX(DEC(AGENT_LOAD_TRGT_DEMAND, 5, 2)) AS THREAD_DEMAND,
MAX(DEC(SORT_SHRHEAP_DEMAND)) AS SORTMEM_DEMAND
FROM TABLE(MON_GET_SERVICE_SUPERCLASS(NULL, -2)) AS T,
TABLE(MON_GET_SERVICE_SUPERCLASS_STATS(NULL,-1)) AS Q
WHERE T.SERVICE_CLASS_ID = Q.SERVICE_CLASS_ID AND
RESOURCE_SHARE_TYPE = 'HARD' AND
T.SERVICE_CLASS_ID IN (SELECT DISTINCT PARENTID
FROM TABLE(MON_GET_ACTIVITY(NULL,-2)) AS T,
SYSCAT.SERVICECLASSES AS S
WHERE T.SERVICE_CLASS_ID = S.SERVICECLASSID AND
ACTIVITY_STATE = 'QUEUED')
GROUP BY T.SERVICE_SUPERCLASS_NAME
SERVICE_CLASS RESOURCE_ENTITLEMENT ENTITLEMENT_TYPE THREAD_DEMAND SORTMEM_DEMAND
------------------------------ -------------------- ---------------- ------------- -----------------
XYZ1 25.00 HARD 25.00 5.