Error "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"

Á

Álvaro Moura

Last updated on Jul 6, 2026

This error occurs when the database needs to search on more than 1 million rows to meet

he requirements of your query.

This limitation does not concern the number of records in a table,but rather how many records

will be read to satisfy a query, so in a table without proper optimization mysql can make multiple

​queries to fit the result of a query, addition of indexes, causes mysql to scan fewer records.

  • To solve the error in question:

Optimize your query and also create index in your tables, thus increasing the performance of your database.