Session priority
Allow priority specification of requests through workload specification or through a stored procedure.
Priority setting within a superclass
The priority of work that is submitted to admission control can be used to control the ordering of admittance to work into the database. The available levels for priority specification are CRITICAL, HIGH, MEDIUM, and LOW.
Within a superclass, consider a scenario where four activities enter the system in the following order:
- Activity 1 - A1 with LOW priority
- Activity 2 - A2 with HIGH priority
- Activity 3 - A3 with LOW priority
- Activity 4 - A4 with CRITICAL priority
- A4
- A2
- A1
- A3
If A4 is released, and if another query enters the system, for example, A5 of MEDIUM priority, the activities are queued in the following order:
- A2
- A5
- A1
- A3
Priority setting across superclasses
Across superclasses, activities that are at the front of the superclass queues are admitted based on how underserved a superclass is compared to all other superclasses with queued work.
Assuming that you use the superclass from Example 1 with the four queued activities (A2, A5, A1, and A3), and a second superclass with a single queued activity B1 with LOW priority. Assuming also that the second superclass is more underserved that the first one, the activities would be queued in the following order:
- A4
- B1
- A2
- A1
- A3
Priority setting through workload specification
You can do priority customization through workload definitions by specifying the priority level for work mapping to the specified workload. For example, the following DDL creates a workload, PAYROLL, where the user NEWTON executes its work at HIGH priority within the HUMAN_RESOURCES service class.
db2 "CREATE WORKLOAD PAYROLL SESSION_USER('NEWTON') SERVICE CLASS HUMAN_RESOURCES PRIORITY HIGH POSITION AT 1"
Priority setting through a stored procedure
You can use also the WLM_SET_SESSION_PRIORITY() stored procedure to set a session priority for the specified application to the specified level. For example, the following SQL sets the session priority for application 0-2361 to LOW:
db2 "call SYSPROC.WLM_SET_SESSION_PRIORITY(2361, 'LOW')"