Note
This variable was introduced in V2.1.
Description
The parallel_servers_target variable specifies the number of threads consumed by parallel execution (PX) statements on each server before PX statements need to wait in the queue.
Privilege requirements
Query variables
Users in the
systenant and all user tenants can execute theSHOW VARIABLESstatement or theSYS.TENANT_VIRTUAL_GLOBAL_VARIABLEview (in Oracle mode) and theinformation_schema.GLOBAL_VARIABLESview (in MySQL mode) to query the values of global system variables.Modify variables
Users in the
systenant can directly modify the values of global system variables.MySQL users in a user tenant must have the
SUPERorALTER SYSTEMprivilege to modify the values of global system variables.For V4.x, users in an Oracle user tenant must have the
ALTER SYSTEMprivilege to modify the values of global system variables starting from V4.2.0.
Attributes
| Attribute | Description |
|---|---|
| Type | Int |
| Default value | 0, which has no special meaning. This value is automatically set when a tenant is created. |
| Value range | [0, 9223372036854775807] |
| Applicability | GLOBAL |
| Modifiable | Yes. You can modify this variable by using the SET statement. |
Considerations
The parallel_servers_target variable is a tenant-level variable. When you create a tenant, perform the following steps:
If the
parallel_servers_targetvalue is specified in the tenant creation statement, theparallel_servers_targetvalue of the tenant is set to the specified value.The following statement creates a tenant and specifies the
parallel_servers_targetvalue:obclient> CREATE TENANT IF NOT EXISTS <tenant_name> CHARSET='utf8mb4', ZONE_LIST=('zone1'), PRIMARY_ZONE='zone1', RESOURCE_POOL_LIST=('<pool_name>') set parallel_servers_target = 624;If the
parallel_servers_targetvalue is not specified in the tenant creation statement, the value ofmin_cpuis used to automatically calculate a value for theparallel_servers_targetvariable when the tenant is created.You can execute the following statement to query the value of
parallel_servers_targetin the tenant:obclient> show variables like 'parallel_servers_target';The
parallel_servers_targetvalue automatically calculated by the system is usually small and can meet only simple parallel query requirements. If you want to perform parallel operations in the tenant, we recommend that you manually set the value ofparallel_servers_targetto a larger value. The recommended algorithm isparallel_servers_target = max_cpu * 10.
Examples
Set the number of threads consumed by parallel queries on each server to 624.
obclient> SET GLOBAL parallel_servers_target = 624;