DB2 10.5 for Linux, UNIX, and Windows

CREATE WORK ACTION SET statement

The CREATE WORK ACTION SET statement defines a work action set and work actions within the work action set.

Invocation

This statement can be embedded in an application program or issued interactively. It is an executable statement that can be dynamically prepared only if DYNAMICRULES run behavior is in effect for the package (SQLSTATE 42509).

Authorization

The privileges held by the authorization ID of the statement must include WLMADM or DBADM authority.

Syntax

Read syntax diagramSkip visual syntax diagram
>>-CREATE WORK ACTION SET--work-action-set-name----------------->

>--FOR--+-DATABASE-------------------------------+-------------->
        +-SERVICE CLASS--service-superclass-name-+   
        '-WORKLOAD--workload-name----------------'   

>--USING WORK CLASS SET--work-class-set-name-------------------->

                                             .-ENABLE--.   
>--+--------------------------------------+--+---------+-------><
   |    .-,--------------------------.    |  '-DISABLE-'   
   |    V                            |    |                
   '-(----| work-action-definition |-+--)-'                

work-action-definition

|--WORK ACTION--work-action-name-------------------------------->

>--ON WORK CLASS--work-class-name------------------------------->

>--| action-types-clause |--| histogram-template-clause |------->

   .-ENABLE--.   
>--+---------+--------------------------------------------------|
   '-DISABLE-'   

action-types-clause

                   .-WITH NESTED----.                                     
|--+-MAP ACTIVITY--+----------------+--TO--service-subclass-name------+--|
   |               '-WITHOUT NESTED-'                                 |   
   +-WHEN--| threshold-types-clause |--| threshold-exceeded-actions |-+   
   +-PREVENT EXECUTION------------------------------------------------+   
   +-COUNT ACTIVITY---------------------------------------------------+   
   +-COLLECT ACTIVITY DATA--| collect-activity-data-clause |----------+   
   |                                  .-BASE-----.                    |   
   '-COLLECT AGGREGATE ACTIVITY DATA--+----------+--------------------'   
                                      '-EXTENDED-'                        

threshold-types-clause

    (1)                                           .-AND QUEUEDACTIVITIES > 0---------.              
|------+-CONCURRENTDBCOORDACTIVITIES-->--integer--+----------------------------------+----------+--|
       |                                          +-AND QUEUEDACTIVITIES-->--integer-+          |   
       |                                          '-AND QUEUEDACTIVITIES UNBOUNDED---'          |   
       +-SQLTEMPSPACE-->--integer--+-K-+--------------------------------------------------------+   
       |                           +-M-+                                                        |   
       |                           '-G-'                                                        |   
       +-SQLROWSRETURNED-->--integer------------------------------------------------------------+   
       +-ESTIMATEDSQLCOST-->--bigint------------------------------------------------------------+   
       |                                         .-CHECKING EVERY 60 SECONDS------------------. |   
       +-CPUTIME-->--integer-value--+-HOUR----+--+--------------------------------------------+-+   
       |                            +-HOURS---+  '-CHECKING EVERY--integer-value--+-SECOND--+-' |   
       |                            +-MINUTE--+                                   '-SECONDS-'   |   
       |                            '-MINUTES-'                                                 |   
       |                               .-CHECKING EVERY 60 SECONDS------------------.           |   
       +-SQLROWSREAD-->--bigint-value--+--------------------------------------------+-----------+   
       |                               '-CHECKING EVERY--integer-value--+-SECOND--+-'           |   
       |                                                                '-SECONDS-'             |   
       '-ACTIVITYTOTALTIME-->--integer--+-DAY-----+---------------------------------------------'   
                                        +-DAYS----+                                                 
                                        +-HOUR----+                                                 
                                        +-HOURS---+                                                 
                                        +-MINUTE--+                                                 
                                        +-MINUTES-+                                                 
                                        '-SECONDS-'                                                 

threshold-exceeded-actions

   .-COLLECT ACTIVITY DATA--NONE-----------------------------.   
|--+---------------------------------------------------------+-->
   '-COLLECT ACTIVITY DATA--| collect-activity-data-clause |-'   

>--+-STOP EXECUTION-+-------------------------------------------|
   '-CONTINUE-------'   

collect-activity-data-clause

                     .-MEMBER-.     
   .-ON COORDINATOR--+--------+-.   
|--+----------------------------+------------------------------->
   |         .-MEMBERS-.        |   
   '-ON ALL--+---------+--------'   

   .-WITHOUT DETAILS-----------------------------------------------------.   
>--+---------------------------------------------------------------------+--|
   |       .-,-----------------------------------------.                 |   
   |       V           (2)                             |                 |   
   '-WITH----+-DETAILS-------------------------------+-+--+------------+-'   
             '-SECTION--+--------------------------+-'    '-AND VALUES-'     
                        |                      (3) |                         
                        '-INCLUDE ACTUALS BASE-----'                         

histogram-template-clause

      .-ACTIVITY LIFETIME HISTOGRAM TEMPLATE--SYSDEFAULTHISTOGRAM-.   
|--●--+-----------------------------------------------------------+-->
      '-ACTIVITY LIFETIME HISTOGRAM TEMPLATE--template-name-------'   

      .-ACTIVITY QUEUETIME HISTOGRAM TEMPLATE--SYSDEFAULTHISTOGRAM-.   
>--●--+------------------------------------------------------------+-->
      '-ACTIVITY QUEUETIME HISTOGRAM TEMPLATE--template-name-------'   

      .-ACTIVITY EXECUTETIME HISTOGRAM TEMPLATE--SYSDEFAULTHISTOGRAM-.   
>--●--+--------------------------------------------------------------+-->
      '-ACTIVITY EXECUTETIME HISTOGRAM TEMPLATE--template-name-------'   

      .-ACTIVITY ESTIMATEDCOST HISTOGRAM TEMPLATE--SYSDEFAULTHISTOGRAM-.   
>--●--+----------------------------------------------------------------+-->
      '-ACTIVITY ESTIMATEDCOST HISTOGRAM TEMPLATE--template-name-------'   

      .-ACTIVITY INTERARRIVALTIME HISTOGRAM TEMPLATE--SYSDEFAULTHISTOGRAM-.      
>--●--+-------------------------------------------------------------------+--●--|
      '-ACTIVITY INTERARRIVALTIME HISTOGRAM TEMPLATE--template-name-------'      

Notes:
  1. Only one work action of the same threshold type can be applied to a single work class at a time.
  2. The DETAILS keyword is the minimum to be specified, followed by the option separated by a comma.
  3. This clause does not apply to thresholds.

Description

work-action-set-name
Names the work action set. This is a one-part name. It is an SQL identifier (either ordinary or delimited). The work-action-set-name must not identify a work action set that already exists at the current server (SQLSTATE 42710). The name must not begin with the characters 'SYS' (SQLSTATE 42939).
FOR
Specifies the database manager object to which the actions in this work action set will apply. Each database manager object can have only one work action set defined for it (SQLSTATE 5U017).
DATABASE
The actions in this work action set are to apply to the database. If DATABASE is specified, the MAP ACTIVITY action cannot be specified (SQLSTATE 5U034).
SERVICE CLASS service-superclass-name
The actions in this work action set are to apply to service-superclass-name. If SERVICE CLASS is specified, threshold actions cannot be specified (SQLSTATE 5U034). The service-superclass-name must exist at the current server (SQLSTATE 42704). The service-superclass-name must not be a service subclass and cannot be any of the following classes (SQLSTATE 5U032):
  • The system service class (SYSDEFAULTSYSTEMCLASS)
  • The maintenance service class (SYSDEFAULTMAINTENANCECLASS)
  • The default user service class (SYSDEFAULTUSERCLASS)
WORKLOAD workload-name
The actions in this work action set are to apply to workload workload-name. If WORKLOAD is specified, the MAP ACTIVITY action cannot be specified (SQLSTATE 5U034). The workload-name must exist at the current server (SQLSTATE 42704). The workload-name cannot be the SYSDEFAULTADMWORKLOAD (SQLSTATE 5U032).
USING WORK CLASS SET work-class-set-name
Specifies the work class set containing the work classes that will classify database activities on which to perform actions. The work-class-set-name must exist at the current server (SQLSTATE 42704).
work-action-definition
Specifies the definition of the work action.
WORK ACTION work-action-name
Names the work action. The work-action-name must not identify a work action that already exists at the current server under this work action set (SQLSTATE 42710). The work-action-name cannot begin with 'SYS' (SQLSTATE 42939).
ON WORK CLASS work-class-name
Specifies the work class that identifies the database activities to which this work action will apply. The work-class-name must exist in the work-class-set-name at the current server (SQLSTATE 42704).
MAP ACTIVITY
Specifies a work action of mapping the activity. This action can only be specified if the object for which this work action set is defined is a service superclass (SQLSTATE 5U034).
WITH NESTED or WITHOUT NESTED
Specifies whether or not activities that are nested under this activity are mapped to the service subclass. The default is WITH NESTED.
WITH NESTED
All database activities that have a nesting level of zero that are classified under the work class, and all database activities nested under this activity, are mapped to the service subclass; that is, activities with a nesting level greater than zero are run under the same service class as activities with a nesting level of zero.
WITHOUT NESTED
Only database activities that have a nesting level of zero that are classified under the work class are mapped to the service subclass. Database activities that are nested under this activity are handled according to their activity type.
TO service-subclass-name
Specifies the service subclass to which activities are to be mapped. The service-subclass-name must already exist in the service-superclass-name at the current server (SQLSTATE 42704). The service-subclass-name cannot be the default service subclass, SYSDEFAULTSUBCLASS (SQLSTATE 5U018).
WHEN
Specifies the threshold that will be applied to the database activity that is associated with the work class for which this work action is defined. A threshold can only be specified if the database manager object for which this work action set is defined is a database or a workload (SQLSTATE 5U034). None of these thresholds apply to internal database activities initiated by the database manager or to database activities generated by administrative SQL routines.
threshold-types-clause
For a description of valid threshold types, see "CREATE THRESHOLD" statement.
threshold-exceeded-actions
For a description of valid threshold-exceeded actions, see "CREATE THRESHOLD" statement.
PREVENT EXECUTION
Specifies that none of the database activities associated with the work class for which this work action is defined will be allowed to run (SQLSTATE 5U033).
COUNT ACTIVITY
Specifies that all of the database activities associated with the work class for which this work action is defined are to be run and that each time one is run, the counter for the work class will be incremented.
COLLECT ACTIVITY DATA
Specifies that data about each activity associated with the work class for which this work action is defined is to be sent to any active activities event monitor when the activity completes. The default is COLLECT ACTIVITY DATA WITHOUT DETAILS.
collect-activity-data-clause
ON COORDINATOR MEMBER
Specifies that the activity data is to be collected only at the coordinator member of the activity.
ON ALL MEMBERS
Specifies that activity data is to be collected at all members where the activity is processed. On remote members, a record for the activity may be captured multiple times as the activity comes and goes on those members. If the AND VALUES clause is specified, activity input values will be collected only for the members of the coordinator.
WITHOUT DETAILS
Specifies that data about each activity that executes in the service class should be sent to any active activities event monitor, when the activity completes execution. Details about statement, compilation environment, and section environment data are not sent.
WITH
DETAILS
Specifies that statement and compilation environment data is to be sent to any active activities event monitor, for those activities that have them. Section environment data is not sent.
SECTION
Specifies that statement, compilation environment, section environment data, and section actuals are to be sent to any active activities event monitor for those activities that have them. DETAILS must be specified if SECTION is specified. Section actuals will be collected on any member where the activity data is collected.
INCLUDE ACTUALS BASE
Specifies that section actuals should also be collected on any partition where the activity data is collected. For section actuals to be collected, either INCLUDE ACTUALS clause must be specified or the section_actuals database configuration parameter must be set.

The effective setting for the collection of section actuals is the combination of the INCLUDE ACTUALS clause, the section_actuals database configuration parameter, and the <collectsectionactuals> setting specified on the WLM_SET_CONN_ENV routine. For example, if INCLUDE ACTUALS BASE is specified, yet the section_actuals database configuration parameter value is NONE and <collectsectionactuals> is set to NONE, then the effective setting for the collection of section actuals is BASE.

BASE specifies that the following should be enabled and collected during the activity's execution:
  • Basic operator cardinality counts
  • Statistics for each object referenced (DML statements only)
AND VALUES
Specifies that input data values are to be sent to any active activities event monitor, for those activities that have them. This data does not include SQL statements that are compiled by using the REOPT ALWAYS bind option.
COLLECT AGGREGATE ACTIVITY DATA
Specifies that aggregate activity data is to be captured for activities that are associated with the work class for which this work action is defined and sent to the statistics event monitor, if one is active. This information is collected periodically on an interval that is specified by the wlm_collect_int database configuration parameter. The default is COLLECT AGGREGATE ACTIVITY DATA BASE. This clause cannot be specified for a work action defined in a work action set that is applied to a database.
BASE
Specifies that basic aggregate activity data should be captured for activities associated with the work class for which this work action is defined and sent to the statistics event monitor, if one is active. Basic aggregate activity data includes:
  • Estimated activity cost high watermark
  • Rows returned high watermark
  • Temporary table space usage high watermark. Only activities that have an SQLTEMPSPACE threshold applied to them participate in this high watermark.
  • Activity life time histogram
  • Activity queue time histogram
  • Activity execution time histogram
EXTENDED
Specifies that all aggregate activity data should be captured for activities associated with the work class for which this work action is defined and sent to the statistics event monitor, if one is active. This includes all basic aggregate activity data plus:
  • Activity data manipulation language (DML) estimated cost histogram
  • Activity DML inter-arrival time histogram
ENABLE or DISABLE
Specifies whether or not the work action is to be considered when database activities are submitted. The default is ENABLE.
ENABLE
Specifies that the work action is enabled and will be considered when database activities are submitted.
DISABLE
Specifies that the work action is disabled and will not be considered when database activities are submitted.
ENABLE or DISABLE
Specifies whether or not the work action set is to be considered when database activities are submitted. The default is ENABLE.
ENABLE
Specifies that the work action set is enabled and will be considered when database activities are submitted.
DISABLE
Specifies that the work action set is disabled and will not be considered when database activities are submitted.
histogram-template-clause
Specifies histogram templates to use when collecting aggregate activity data for activities associated with the work class to which this work action is assigned. Aggregate activity data is only collected for the work class when the work action type is COLLECT AGGREGATE ACTIVITY DATA.
ACTIVITY LIFETIME HISTOGRAM TEMPLATE template-name
Specifies the template that describes the histogram used to collect statistical data about the duration, in milliseconds, of database activities running during a specific interval. The database activities are those associated with the work class to which this work action is assigned. This time includes both time queued and time executing. The default is SYSDEFAULTHISTOGRAM. This information is only collected when the COLLECT AGGREGATE ACTIVITY DATA clause is specified, with either the BASE or EXTENDED option.
ACTIVITY QUEUETIME HISTOGRAM TEMPLATE template-name
Specifies the template that describes the histogram used to collect statistical data about the length of time, in milliseconds, that database activities are queued during a specific interval. The database activities are those associated with the work class to which this work action is assigned. The default is SYSDEFAULTHISTOGRAM. This information is only collected when the COLLECT AGGREGATE ACTIVITY DATA clause is specified, with either the BASE or EXTENDED option.
ACTIVITY EXECUTETIME HISTOGRAM TEMPLATE template-name
Specifies the template that describes the histogram used to collect statistical data about the length of time, in milliseconds, that database activities are executing during a specific interval. The database activities are those associated with the work class to which this work action is assigned. This time does not include the time spent queued. Activity execution time is collected in this histogram at each member where the activity executes. On the activity's coordinator member, this is the end-to-end execution time (that is, the life time less the time spent queued). On non-coordinator members, this is the time that these members spend working on behalf of the activity. During the execution of a given activity, the database manager might present work to a non-coordinator member more than once, and each time the non-coordinator member will collect the execution time for that occurrence of the activity. Therefore, the counts in the execution time histogram might not represent the actual number of unique activities that executed on a member. The default is SYSDEFAULTHISTOGRAM. This information is only collected when the COLLECT AGGREGATE ACTIVITY DATA clause is specified, with either the BASE or EXTENDED option.
ACTIVITY ESTIMATEDCOST HISTOGRAM TEMPLATE template-name
Specifies the template that describes the histogram used to collect statistical data about the estimated cost, in timerons, of DML activities associated with the work class to which this work action is assigned. The default is SYSDEFAULTHISTOGRAM. This information is only collected when the COLLECT AGGREGATE ACTIVITY DATA clause is specified with the EXTENDED option.
ACTIVITY INTERARRIVALTIME HISTOGRAM TEMPLATE template-name
Specifies the template that describes the histogram used to collect statistical data about the length of time, in milliseconds, between the arrival of one DML activity and the arrival of the next DML activity, for any activity associated with the work class to which this work action is assigned. The default is SYSDEFAULTHISTOGRAM. This information is only collected when the COLLECT AGGREGATE ACTIVITY DATA clause is specified with the EXTENDED option.

Rules

Notes

Examples