• Data Warehouse Service

dws
  1. Help Center
  2. Data Warehouse Service
  3. Developer Guide
  4. SQL Reference
  5. SQL Syntax
  6. CREATE WORKLOAD GROUP

CREATE WORKLOAD GROUP

Function

CREATE WORKLOAD GROUP creates a workload group, associates it to an existing resource pool, and specifies the number of concurrent SQL statements in the resource pool.

Precautions

As long as the current user has CREATE permission, the user can create a workload group.

Syntax

CREATE WORKLOAD GROUP wg_name
     [ USING RESOURCE POOL pool_name [ WITH ( ACT_STATEMENTS = counts) ] ];

Parameter description

  • wg_name

    Specifies the name of the workload group to be deleted.

    NOTE:

    A workload group must be unique in a database.

    Value range: A string. It must comply with the naming convention rule.

  • pool_name

    Specifies the name of the resource pool.

    Value range: A string. It must comply with the naming convention rule.

  • counts

    Specifies the number of concurrent SQL statements in the resource pool that the workload group belongs to.

    Value range: An integer ranging from -1 to INT_MAX.

Examples

-- Create a default workload group associated to the default resource pool:
CREATE WORKLOAD GROUP wg_name1;

-- Create the resource pool named pool1:
CREATE RESOURCE POOL pool1;

-- Create a workload group and associate it with an existing resource pool:
CREATE WORKLOAD GROUP wg_name2 USING RESOURCE POOL pool1;

-- Create a workload group, associate it with an existing resource pool, and set the number of concurrent SQL statements to 10:
CREATE WORKLOAD GROUP wg_name3 USING RESOURCE POOL pool1 WITH (ACT_STATEMENTS=10);

-- Delete the workload group and the resource pool:
DROP WORKLOAD GROUP wg_name1;
DROP WORKLOAD GROUP wg_name2;
DROP WORKLOAD GROUP wg_name3;
DROP RESOURCE POOL pool1;