MySQL will not execute select statements that directly examine a very large number of rows. Either adjust your select statement to make it more efficient, such as using index fields instead, or set SQL_BIG_SELECTS=1 in the session before executing the select statement.
To set the SQL_BIG_SELECTS=1, use the following code:
$db->sql_query(“SET SQL_BIG_SELECTS=1”);




