In the days of SQL Server 2000 and 2005, the maximum number of tables in a query was 256.

Does MySQL have a similar limitation?

I know that such query of such size means that either there's something wrong with database design or some data warehousing solution should be used, but let's forget about this for a while and focus on theoretical capabilities of MySQL.

  • 2
    Just FYI - that 256 table limit was for SQL Server 2005. It's now limited only by server resources: msdn.microsoft.com/en-us/library/ms143432.aspx
    – Brent Ozar
    Aug 2, 2014 at 18:28
  • @BrentOzar That's a very old question, possibly one of those posted during the beta period to seed DBA.SE with content. Anyway, thanks for pointing out the issue! I edited the question to make it more precise. Aug 2, 2014 at 18:53

1 Answer 1


Limitations of Joins

In MySQL (4.0, 5.0, 5.5), the maximum number of tables that can be referenced in a single join is 61. This also applies to the number of tables that can be referenced in the definition of a view.

  • thanks for posting! I had 68 joins. No wonder why my query didn't work. LOL!
    – MacGyver
    May 31, 2012 at 5:32
  • JK :-) ... HAHA
    – MacGyver
    May 31, 2012 at 5:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.