Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
Just FYI - that 256 table limit was for SQL Server 2005. It's now limited only by server resources: – Brent Ozar Aug 2 '14 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. – Marek Grzenkowicz Aug 2 '14 at 18:53
up vote 8 down vote accepted

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.

share|improve this answer
thanks for posting! I had 68 joins. No wonder why my query didn't work. LOL! – MacGyver May 31 '12 at 5:32
JK :-) ... HAHA – MacGyver May 31 '12 at 5:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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