When running a query that join data from 3 large tables I’m getting an error that says
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
When running a query that join data from 3 large tables I’m getting an error that says
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
您可以简单地发出包含 SET 命令的查询:
$this->db->query('SET SQL_BIG_SELECTS=1');
似乎您必须进行大量选择。正如 Faizan 所说,您可以在配置文件中设置 SQL_BIG_SELECTS=1 或在活动会话中定义全局变量(无需重新启动服务)。
另外,请查看此文档。http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html#sysvar_max_join_size。了解参数的影响是件好事。也许您的初始选择未针对所需结果进行优化。只是一个额外的想法。