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

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

问题描述

我正在使用PHP和MySQL.在我的程序中,有一个涉及联接的选择查询.当我在localhost上运行它时,它工作正常,但是当我将其上载到服务器上并尝试执行它时,它将生成以下错误:

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

我该如何纠正?

推荐答案

使用PHP时,

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天全站免登陆