Example: Using a work class set to manage specific types of activities

The following example shows how to use a work class set to manage DML activities.

Assume that you have a large number of applications running on your NONAME database each day and lately a few performance issues have been occurring. To deal with some of these issues, you decide that you need to be able to control the number of large queries (that is, any query that has an estimated cost of greater than 9999 timerons or an estimated cardinality of greater than 9999 rows) that can run simultaneously on the database.

To control the number of large queries that can run on the database, you would do the following:
  1. Create a MYWORKCLASSSET work class set that contains two work classes: one for queries with a large estimated cost and one for queries with a large estimated cardinality. For example:
    CREATE WORK CLASS SET MYWORKCLASSSET
    	(WORK CLASS LARGEESTIMATEDCOST WORK TYPE DML
    FOR TIMERONCOST FROM 10000 TO UNBOUNDED,
    WORK CLASS LARGECARDINALITY WORK TYPE DML
    FOR CARDINALITY FROM 10000 TO UNBOUNDED)
    
  2. Create a DATABASEACTIONS work action set that contains two work actions that are to be applied to the work classes in the MYWORKCLASSSET work class set at the database level
    CREATE WORK ACTION SET DATABASEACTIONS FOR DATABASE
    USING WORK CLASS SET LARGEQUERIES
    (WORK ACTION ONECONCURRENTQUERY ON WORK CLASS LARGEESTIMATEDCOST
    WHEN CONCURRENTDBCOORDACTIVITIES > 1 AND QUEUEDACTIVITIES > 1 STOP EXECUTION,
    WORK ACTION TWOCONCURRENTQUERIES ON WORK CLASS LARGECARDINALITY
    WHEN CONCURRENTDBCOORDACTIVITIES > 2 AND QUEUEDACTIVITIES > 3 STOP EXECUTION) 

In addition, several large administrative applications run daily against the database, and you want these applications to run in one resource pool. To accomplish this goal, you would create a service superclass called ADMINAPPS for these applications. For each application, you would create a workload to map it to the ADMINAPPS service superclass.

Because it is important that the queries (SELECT statements) run quickly, you decide to create a service subclass called SELECTS in the ADMINAPPS service superclass for these queries.

To map the SELECT statements to the SELECTS service subclass:
  1. Create a SELECTDML work class set that contains a work class for all SELECT statements that do not update the database:
    CREATE WORK CLASS SET SELECTDML (WORK CLASS SELECTCLASS WORK TYPE READ)
  2. Create an ADMINAPPSACTIONS work action set. This work action set contains a work action that is to be applied to the work class in work class set SELECTDML at the service superclass level
    CREATE WORK ACTION SET ADMINAPPSACTIONS FOR SERVICE CLASS ADMINAPPS
    USING WORK CLASS SET SELECTDML
    (WORK ACTION MAPSELECTS ON WORK CLASS SELECTCLASS MAP ACTIVITY TO SELECTS)