CREATE RESOURCE POOL
Description
Creates a resource pool and specifies the Cgroup of the resource pool.
Precautions
Only a user with the CREATE permission on the current database can perform this operation.
Syntax
1 2 |
CREATE RESOURCE POOL pool_name [WITH (CONTROL_GROUP="group_name",{MEM_PERCENT=pct| ACTIVE_STATEMENTS=stmt | MAX_DOP = dop | MEMORY_LIMIT='memory_size' | io_limits=io_limits | io_priority='io_priority' | nodegroup="nodegroupname" | is_foreign=boolean }[, ... ])]; |
Parameters
- pool_name
Specifies the name of a resource pool.
The name of the resource pool cannot be same as that of an existing resource pool.
Value range: a string. It must comply with the naming convention.
- group_name
Specifies the name of a Cgroup.
- You can use either double quotation marks ("") or single quotation marks ('') in the syntax when setting the name of a Cgroup.
- The value of group_name is case-sensitive.
- If an administrator specifies a Workload Cgroup under Class, for example, control_group set to class1:workload1, the resource pool will be associated with the workload1 Cgroup under class1. The level of Workload can also be specified. For example, control_group is set to class1:workload1:1.
- If a database user specifies the Timeshare string (Rush, High, Medium, or Low) in the syntax, for example, control_group is set to High, the resource pool will be associated with the High Timeshare Cgroup under DefaultClass.
- When creating a resource pool, you must specify an associated Cgroup. The created resource pool cannot be associated with the default Cgroup, that is, the Medium Timeshare Cgroup under the DefaultClass Cgroup.
Value range: a string. It must comply with the rule in the description, which specifies the created Cgroup.
- stmt
Specifies the maximum number of statements that can be concurrently executed in a resource pool.
Value range: numeric data ranging from –1 to 2147483647
- dop
Specifies the maximum statement concurrency degree for a resource pool, equivalent to the number of threads that can be created for executing a statement.
Value range: numeric data ranging from 1 to 2147483647
- memory_size
Specifies the maximum memory size of a resource pool.
Value range: a string from 1 KB to 2047 GB
- mem_percent
Specifies the proportion of available resource pool memory to the total memory or group user memory.
In multi-tenant scenarios, mem_percent of group users or service users ranges from 1 to 100. The default value is 20.
In common scenarios, mem_percent of common users ranges from 0 to 100. The default value is 0.
When both of mem_percent and memory_limit are specified, only mem_percent takes effect.
- io_limits
Specifies the upper limit of IOPS in a resource pool.
It is counted by 10 thousands per second.
- io_priority
Specifies the I/O priority for jobs that consume many I/O resources. It takes effect when the I/O usage reaches 90%.
There are three priorities: Low, Medium, and High. If you do not want to control I/O resources, use the default value None.
The settings of io_limits and io_priority are valid only for complex jobs, such as batch import (using INSERT INTO SELECT, COPY FROM, or CREATE TABLE AS), complex queries involving over 500 MB data on each DN, and VACUUM FULL.
- nodegroup
Specifies the name of the logical database instance in logical database instance mode. The value must be an existing logical database instance.
If the logical database instance name contains uppercase letters or special characters or begins with a digit, enclose the name with double quotation marks ("") in SQL statements.
- is_foreign
Specifies the current resource pool to control the resources of common users who are not associated with the logical database instance specified by nodegroup in logical database instance mode.
- nodegroup must specify an existing logical database instance, and cannot be elastic_group or the default node group (specified by group_version1), which is generated during database instance installation.
- If is_foreign is set to true, the resource pool cannot be associated with users. That is, CREATE USER ... RESOURCE POOL cannot be used to configure resource pools for users. The resource pool automatically checks whether the users are associated with its logical database instance. If they are not, they will be controlled by the resource pool when performing operations on database nodes in the logical database instance.
- max_workers
Concurrency in a table during data redistribution. This column is used only for scaling.
- max_connections
Maximum number of connections that can be used by a resource pool.
The total maximum number of connections in all resource pools cannot exceed the maximum number of connections specified by max_connections of the entire GaussDB process.
Examples
This example assumes that you have created a Cgroup in advance. (Contact the administrator to create a Cgroup.)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
-- Create a resource pool, and associate it with the Medium Timeshare Cgroup under the class1 Cgroup. gaussdb=# CREATE RESOURCE POOL pool1 WITH (CONTROL_GROUP="class1:Medium"); -- Create a resource pool and specify the High Timeshare Workload Cgroup under the DefaultClass Cgroup. gaussdb=# CREATE RESOURCE POOL pool2 WITH (CONTROL_GROUP="High"); -- Create a resource pool, and associate it with the Low Timeshare Cgroup under Workload under class1. gaussdb=# CREATE RESOURCE POOL pool3 WITH (CONTROL_GROUP="class1:Low"); -- Create a resource pool, and associate it with the wg1 Workload Cgroup under class1. gaussdb=# CREATE RESOURCE POOL pool4 WITH (CONTROL_GROUP="class1:wg1"); -- Create a resource pool, and associate it with the wg2 Workload Cgroup under class1. gaussdb=# CREATE RESOURCE POOL pool5 WITH (CONTROL_GROUP="class1:wg2:3"); -- Delete the resource pool. gaussdb=# DROP RESOURCE POOL pool1; gaussdb=# DROP RESOURCE POOL pool2; gaussdb=# DROP RESOURCE POOL pool3; gaussdb=# DROP RESOURCE POOL pool4; gaussdb=# DROP RESOURCE POOL pool5; |
Helpful Links
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot