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 ..