My script gives an error that the MAX_JOIN_SIZE in MySQL is set too low. How do I increase it?

Knowledge Base

My script gives an error that the MAX_JOIN_SIZE in MySQL is set too low. How do I increase it?

MySQL won't execute select statements that need to directly examine a very large number of rows. You should either adjust your select statement to make it more efficient (eg. use index fields), or set SQL_BIG_SELECTS=1 in the session before executing the large select statement. Use something like this to do that .. 

$db->sql_query("SET SQL_BIG_SELECTS=1");