MySQL uses bits when optimizing join conditions; By default MySQL uses an ulong for this, which limits the number of tables to 32 on 32 bit system. To increase this, you can change in sql/mysql_priv.h: typedef ulong table_map to typedef ulonglong table_map and recompile.