MySQL Variables sql_big_selects 数据库 参数变量解释及正确配置使用
本站中文解释
sql_big_selects参数用于设置数据库服务器是否允许执行大规模查询操作,以改善性能。MySQL查询是任何Web应用程序中最常见的操作之一,但可能因为太多而占用资源过多而影响服务器性能。
sql_big_selects参数有四个不同的设置选项:
1、OFF: 所有查询操作均受到限制,并且不允许执行大规模操作;
2、ON: 允许执行大查询操作;
3、SMALL_RESULT: 允许运行大面积查询操作,但要求返回结果集小于max_heap_table_size参数的值;
4、BIG_RESULT: 允许运行大面积查询操作,但要求返回结果不能超过服务器可以使用的内存大小。
设置此参数只需在MySQL服务器的配置文件my.cnf中添加:
sql_big_selects=ON
保存并重新启动MySQL服务器即可。
官方英文解释
sql_big_selects
System Variable | sql_big_selects |
---|---|
Scope | Global, Session |
Dynamic | Yes |
Type | Boolean |
Default Value | ON |
If set to OFF
, MySQL aborts
SELECT
statements that are
likely to take a very long time to execute (that is,
statements for which the optimizer estimates that the number
of examined rows exceeds the value of
max_join_size
). This is
useful when an inadvisable WHERE
statement
has been issued. The default value for a new connection is
ON
, which permits all
SELECT
statements.
If you set the max_join_size
system variable to a value other than
DEFAULT
,
sql_big_selects
is set to
OFF
.