MySQL Variables div_precision_increment 数据库 参数变量解释及正确配置使用
本站中文解释
MySQL 中div_precision_increment 参数变量及其用途如下所示:
div_precision_increment 是MySQL服务器计算除法运算时,增加在除数和被除数的小数位中的精度增量。该参数的值必须是10的整数次方,一般可以设置取值为1或2。
设置 div_precision_increment 参数可以使用MySQL服务器的SQL语句,例如:
SET GLOBAL div_precision_increment=2; #设置 div_precision_increment 参数的取值为2
因为要经常使用到,所以建议将其设置在MySQL服务器的my.cnf文件中,例如:
[mysqld]
div_precision_increment = 2 #设置 div_precision_increment 参数的取值为2
以上是MySQL中 div_precision_increment 参数变量及用途以及如何设置的详细说明。
官方英文解释
div_precision_increment
Command-Line Format | --div-precision-increment=# |
---|---|
System Variable | div_precision_increment |
Scope | Global, Session |
Dynamic | Yes |
Type | Integer |
Default Value | 4 |
Minimum Value | 0 |
Maximum Value | 30 |
This variable indicates the number of digits by which to
increase the scale of the result of division operations
performed with the
/
operator.
The default value is 4. The minimum and maximum values are 0
and 30, respectively. The following example illustrates the
effect of increasing the default value.
mysql>SELECT 1/7;
+--------+ | 1/7 | +--------+ | 0.1429 | +--------+ mysql>SET div_precision_increment = 12;
mysql>SELECT 1/7;
+----------------+ | 1/7 | +----------------+ | 0.142857142857 | +----------------+