DB2 Version 9.7 for Linux, UNIX, and Windows

Creating a workload

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

About this task

To create a workload:

Before you begin

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

Procedure

  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 under which occurrences of this workload are to be executed. The SYSDEFAULTUSERCLASS service superclass is the default.

      If you specify a user-defined service superclass and do not map the workload to run in a user-defined service subclass under the service superclass, the workload occurrences will run 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 do not want occurrences of the workload to run in the SYSDEFAULTSUBCLASS service subclass, you can map the workload for execution in a user-defined service subclass through the workload. You can also use a work action to map the activities submitted by a workload 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 on 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 reevaluation 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.