1349
MySQLerrorqueryhigh confidence
SELECT would examine more than max_join_size rows
Production Risk
Medium — query blocked; may indicate a missing index or runaway query.
What this means
The query optimizer estimated that the SELECT would examine more rows than the max_join_size system variable allows.
Why it happens
- 1Cartesian JOIN (missing or ineffective JOIN condition)
- 2Very large table with no usable index for the query
- 3max_join_size set to a low value for a safety guard
How to reproduce
trigger — this will error
trigger — this will error
SET max_join_size = 1000; SELECT * FROM large_table;
expected output
ERROR 1349 (HY000): The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE clause and use SET SQL_BIG_SELECTS=1 or SET MAX_JOIN_SIZE=# if the SELECT is okay
Fix 1
Add indexes or refine the WHERE clause
Add indexes or refine the WHERE clause
EXPLAIN SELECT ...;
Why this works
Identify the query plan to add missing indexes.
Fix 2
Allow the large query explicitly
Allow the large query explicitly
SET SQL_BIG_SELECTS = 1;
Why this works
Disables the max_join_size safety guard for the session.
What not to do
✕
Sources
Official documentation ↗
MySQL 8.0 — 1349 ER_TOO_BIG_SELECT
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev