MySQL: "The SELECT would examine more than MAX_JOIN_SIZE rows"

Solution 1:

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>';
}

Solution 2:

Try running as a query previous executing your select:

SET SQL_BIG_SELECTS=1

Is this really executing over a huge dataset? If not this should be solved in a different way.