MySQL-SQL_BIG_SELECTS [英] MySQL - SQL_BIG_SELECTS

查看:146
本文介绍了MySQL-SQL_BIG_SELECTS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,我一直在研究SQL_BIG_SELECTS,但是到目前为止,MySQL文档一直没有帮助.我正在寻找一些预防方法,以防止出现以下错误.

Hey, I've been investigating SQL_BIG_SELECTS, but the MySQL documentation so far has been pretty unhelpful. I'm looking for some insight as to preventing errors like the one below from appearing.

错误1104:SELECT将检查太多记录,可能会花费很长时间. 检查您的WHERE,如果SELECT没问题,请使用SET OPTION SQL_BIG_SELECTS = 1

ERROR 1104: The SELECT would examine too many records and probably take a very long time. Check your WHERE and use SET OPTION SQL_BIG_SELECTS=1 if the SELECT is ok

  1. MySQL决定查询多少行为大选择"?
  2. 适当的索引编制通常可以解决此问题吗?
  3. 是将SQL_BIG_SELECTS视为万不得已",还是好的做法?
  4. 有人将如何在配置中设置"SQL_BIG_SELECTS = 1"(无需执行查询)?
  5. 还有其他值得了解的替代方法吗?

提前谢谢!

推荐答案

  1. MySQL根据"max_join_size"的值确定查询是否为大选择".如果查询可能需要检查的行数超过此数目,它将认为它是大选择".使用显示变量"查看最大连接大小的值.

  1. MySQL determines whether or not a query is a 'big select' based on the value of 'max_join_size'. If the query is likely to have to examine more than this number of rows, it will consider it a 'big select'. Use 'show variables' to view the value of the max join size.

我相信索引以及特别好的where子句可以防止出现此问题.

I believe that indexing and particular a good where clause will prevent this problem from occuring.

SQL_BIG_SELECTS用于防止用户意外执行过大的查询.可以在mysql.cnf中将其设置为ON或在启动时使用命令行选项.

SQL_BIG_SELECTS is used to prevent users from accidentally executing excessively large queries. It is okay to set it to ON in mysql.cnf or using the command-line option at startup.

您可以在my.cnf或服务器启动时设置SQL_BIG_SELECTS.也可以使用SET SESSION SQL_BIG_SELECTS=1在会话的基础上进行设置.

You can set SQL_BIG_SELECTS in my.cnf or at server startup. It can also be set on a session basis with SET SESSION SQL_BIG_SELECTS=1.

我想不到.我只是检查您的查询,以确保您确实需要使用它.我们的服务器默认情况下将其打开,并且max_join_size非常大.

Not that I can think of. I would just check your query to make sure that you really need to use it. Our servers have it turned on by default, and max_join_size is very large.

这篇关于MySQL-SQL_BIG_SELECTS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆