DB2 10.5 for Linux, UNIX, and Windows

Creating a workload

Use a CREATE WORKLOAD statement to add a workload to the catalogs.

Before you begin

To create a workload, you require WLMADM or DBADM authority.
See the following topics for more information about prerequisites:

Procedure

To create a workload:

  1. Specify one or more of the following properties for the workload using the CREATE WORKLOAD statement:
    • The name of the workload.
    • The connection attributes. The incoming connection must supply matching connection attributes to those that you specified for the workload for a match to occur. For more information, see Work identification by origin with workloads. When specifying the connection attributes, note that values are ORed and attributes are ANDed: for example, UserID (bob OR sue OR frank) AND Application (SAS).
    • A value that indicates whether occurrences of this workload are permitted to access the database. By default, occurrences of this workload are permitted to access the database.
    • A value that indicates whether the workload is enabled or disabled. By default, the workload is enabled.
    • The service class where work submitted by occurrences of this workload is to be executed. The SYSDEFAULTUSERCLASS service superclass is the default. If you specify a user-defined service superclass, the work submitted by the workload occurrences runs in the SYSDEFAULTSUBCLASS service subclass of the service superclass.
      Note: You cannot specify the SYSDEFAULTSUBCLASS service subclass under any service superclass, including the SYSDEFAULTUSERCLASS service superclass.
      If you have defined a workload to point to a service superclass but do not want work submitted by it to run in the default SYSDEFAULTSUBCLASS service subclass, you can either change the workload definition to point directly to a user-defined service subclass or you can use a work action set defined on the service superclass to map individual pieces of work to a different service subclass. For more information, see Work actions and work action sets.
    • The position of the workload relative to other workloads when cached in the memory. The position of the new workload determines the order in which it is evaluated during workload assignment. By default, the new workload is positioned last, which means that it is evaluated last, immediately before the default user workload is considered. For more information, see Workload assignment.
    • The monitoring activity metrics collection level for activities submitted by connections associated with this workload. The default activity metrics collection setting for a workload is NONE. Note that the effective activity collection setting for activities is the combination of both the workload activity metrics collection level and the mon_act_metrics database configuration parameter.
    • The type of activity information to collect. By default, no information for activities associated with the workload is sent to an activities event monitor.
    • The aggregate activity information to collect. The aggregate activity information used for the workload only changes after the CREATE WORKLOAD operation is committed.
    • The lock timeout events information to collect. By default, data about a lock event is sent to the locking event monitor, if one is active, when the lock event occurs, but previous lock timeout events are not sent (WITHOUT HISTORY).
    • The deadlock information to collect. By default, data about a deadlock event is sent to the locking event monitor, if one is active, when the deadlock event occurs, but previous deadlock events are not sent (WITHOUT HISTORY).
    • The lock wait information to collect. By default, no lock wait information is collected if a lock is not acquired within the set wait time.
    • The unit of work information for each transaction associated with this workload to send to the unit of work event monitor, if one is active, when a unit of work ends. By default, no unit of work information is sent.
    • The histogram templates that the workload should use as templates for its histograms. The histogram templates specified are reflected in the SYSCAT.HISTOGRAMTEMPLATEUSE view. For more information about histograms and histogram templates, see Histograms in workload management.
  2. Commit your changes. When you commit your changes the workload is added to the SYSCAT.WORKLOADS view. Committing the change causes a workload re-evaluation to take place at the beginning of the next unit of work of each application. Depending on which workload is chosen, the application might be reassigned to a different workload.

What to do next

After you create a workload, you might need to grant the USAGE privilege on it to one or more session users. (Session users with WLMADM or DBADM authority have an implicit privilege to use any workload.) Even if a connection provides an exact match to the connection attributes of the workload, if the session user does not have the USAGE privilege on the workload, the data server does not consider the workload when performing workload evaluation. For more information, see Granting the USAGE privilege on a workload.