Updated on 2024-10-14 GMT+08:00

CREATE WORKLOAD GROUP

Function

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

Precautions

Only a user with the CREATE permission on the current database can perform this operation.

Syntax

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

Parameter Description

  • wg_name

    Specifies the workload group name.

    The workload group must be unique in a database.

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

  • pool_name

    Specifies the name of a resource pool.

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

  • 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 2147483647

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
-- Create a default workload group in the default resource pool.
openGauss=# CREATE WORKLOAD GROUP wg_name1;

-- Create the resource pool pool1.
openGauss=# CREATE RESOURCE POOL pool1;

-- Create a workload group and associate it with pool1.
openGauss=# CREATE WORKLOAD GROUP wg_name2 USING RESOURCE POOL pool1;

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

-- Delete the created workload groups and resource pool.
openGauss=# DROP WORKLOAD GROUP wg_name1;
openGauss=# DROP WORKLOAD GROUP wg_name2;
openGauss=# DROP WORKLOAD GROUP wg_name3;
openGauss=# DROP RESOURCE POOL pool1;