PolarDB allows you to specify the parallel_degree_policy parameter to set the degree of parallelism (DOP) policy for parallel queries. This topic describes the parameters that are related to DOP policies.

Prerequisites

A ApsaraDB PolarDB MySQL-compatible edition cluster is used and the revision version must be 8.0.1.1.11 or later. For more information, see Query the kernel version number.

Parameters

Parameter Level Description
parallel_degree_policy Global Specify a DOP policy for an individual query. Valid values:
  • TYPICAL
  • AUTO
  • REPLICA_AUTO (default)
Note For more information on how to use parallel queries, see Parallel query.

TYPICAL

If the parameter is set to TYPICAL, PolarDB sets the DOP to the same value as max_parallel_degree, regardless of database loads, such as the CPU usage.

AUTO

If the parameter is set to AUTO, PolarDB enables or disables parallel queries based on the CPU usage, memory usage, or input/output operations per second (IOPS) usage of the database. PolarDB also sets DOP based on the costs of parallel queries.

Parameter Level Value Description
loose_auto_dop_cpu_pct_hwm Global
  • Valid values: 0 to 100.
  • Default value: 70.
The threshold of the CPU usage. If the CPU usage exceeds the threshold, PolarDB disables parallel queries.
loose_auto_dop_mem_pct_hwm
  • Valid values: 0 to 100.
  • Default value: 90.
The threshold of the memory usage. If the memory usage exceeds the threshold, PolarDB disables parallel queries.
loose_auto_dop_iops_pct_hwm
  • Value values: 0 to 100.
  • Default value: 80.
The threshold of the IOPS usage. If the IOPS usage exceeds the threshold, PolarDB disables parallel queries.
loose_auto_dop_low_degree_cost
  • Value value: 0 to 18446744073709551615.
  • Default value: 500000.
The policy that is used to automatically set DOP. After you enable parallel queries, PolarDB sets the DOP based on the following rules:
  • If the optimizer estimates that the costs of serial queries are lower than the value of this parameter, the DOP is set to 2.
  • If the optimizer estimates that the costs of serial queries are greater than or equal to the value of this parameter, DOP is set to the same value as max_parallel_degree.
Note This parameter is used to set the DOP only after PolarDB enables parallel queries. It is not used to enable or disable parallel queries.

REPLICA_AUTO

If the parameter is set to REPLICA_AUTO, only read-only nodes enable or disable parallel queries based on the CPU usage, memory usage, or IOPS usage of the database. The primary node does not perform parallel queries. The supported parameters are the same as those of AUTO.