All Products
Search
Document Center

ApsaraDB RDS:Use expressions as parameter values

Last Updated:Aug 05, 2024

This topic describes how to use expressions as parameter values for your ApsaraDB RDS for MySQL instance.

Parameter description

You can use dynamic expressions as the values of parameters that are closely related to the instance type. When the instance type of your RDS instance is changed, the values of related parameters can be adaptively changed based on the new instance type. This ensures that the parameter settings match the instance type without manual intervention.

For example, if you set the innodb_buffer_pool_size parameter to the {DBInstanceClassMemory*3/4} expression, the buffer size is automatically changed to three quarters of the instance memory. This ensures that the value of the innodb_buffer_pool_size parameter changes with the instance type to maintain the optimal database performance and high resource usage.

image.png

Expression syntax

Category

Description

Example value

Variable

  • AllocatedStorage: the storage capacity that is supported by the instance type. The value is an integer.

  • DBInstanceClassMemory: the available memory of an RDS instance. The value of this variable is calculated by deducting the memory capacity that is occupied by the control processes on the RDS instance from the memory capacity that is supported by the instance type. The value is an integer. For example, if the memory capacity that is supported by the instance type is 16 GB and the memory capacity that is occupied by the control processes is 4 GB, the value of the DBInstanceClassMemory variable is 12 GB.

  • DBInstanceClassCPU: the number of CPU cores that are supported by the instance type. The value is an integer.

  • DBInstanceClassConnections: the maximum number of connections that are supported by the instance type. The value is an integer.

Note
  • For more information about the instance types and the storage capacity, memory capacity, number of CPU cores, and maximum number of connections that are supported by each instance type, see Primary ApsaraDB RDS instance types.

  • The memory capacity that is occupied by control processes is the smaller value between the values that are calculated by using the following formulas: Memory capacity supported by the instance type × 0.65 and (Memory capacity supported by the instance type/16384 MB + 1) × 2048 MB.

{DBInstanceClassMemory*3/4}

Operator

  • Expression syntax: An expression is enclosed by a pair of braces {}.

  • Division operator (/): This operator is used to divide a number by another number. An integer is returned. If the quotient is a decimal, only the integer part of the quotient is returned. The dividend and the divisor must be integers. For example, ApsaraDB RDS can process {DBInstanceClassMemory*3/4} but not {DBInstanceClassMemory*0.75}.

  • Multiplication operator (*): This operator is used to multiply a number by another number. An integer is returned. If the product is a decimal, only the integer part of the product is returned. The two numbers must be integers.

Function

  • The GREATEST() function returns the largest value from an array of integers or the largest value from the list of expressions sent as a parameter.

  • The LEAST() function returns the smallest value from an array of integers or the smallest value from the list of expressions sent as a parameter.

  • The SUM() function returns the sum of an array of integers or the sum of the list of expressions sent as a parameter.

LEAST({DBInstanceClassMemory/256},10485760)