MySQL:“SELECT 将检查超过 MAX_JOIN_SIZE 行"; [英] MySQL: "The SELECT would examine more than MAX_JOIN_SIZE rows"

查看:44
本文介绍了MySQL:“SELECT 将检查超过 MAX_JOIN_SIZE 行";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 PHP 和 MySQL.在我的程序中有一个涉及连接的选择查询.当我在本地主机上运行它时它工作正常但是当我将它上传到我的服务器并尝试执行它时它会产生以下错误:

SELECT 将检查超过 MAX_JOIN_SIZE 行;检查您的 WHERE 并使用 SET SQL_BIG_SELECTS=1 或 SET SQL_MAX_JOIN_SIZE=# 如果 SELECT 没问题

我该如何纠正?

解决方案

使用 PHP 时,SQL_BIG_SELECTS=1 应该在主查询之前在单独的查询中设置.例如:

$mysqli = new mysqli("localhost", "root", "password", "db");$mysqli->query("SET SQL_BIG_SELECTS=1");//在你的主查询之前设置它$results = $mysqli->query("SELECT a, b, c FROM test");while($row = $results->fetch_assoc()){echo '

';print_r ($row);echo '</pre>';}

I am using PHP and MySQL. In my program there is a select query involving joins. When I run it on localhost it's working fine but when I upload it on my server and try to execute it then it generates the following error:

The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is okay

How can I correct this?

解决方案

When using PHP, SQL_BIG_SELECTS=1 should be set in a separate query before your main query. For example:

$mysqli = new mysqli("localhost", "root", "password", "db"); 

$mysqli->query("SET SQL_BIG_SELECTS=1");  //Set it before your main query

$results = $mysqli->query("SELECT a, b, c FROM test");
while($row = $results->fetch_assoc()){
    echo '<pre>';
    print_r ($row);
    echo '</pre>';
}

这篇关于MySQL:“SELECT 将检查超过 MAX_JOIN_SIZE 行";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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