2013-03-10 45 views
-2

我已经达到了表的行大小设置的限制,所以我无法再向表中添加更多的列。mysql表中的最大列数错误

,我发现了以下错误:

.#1118 - Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. You have to change some columns to TEXT or BLOBs

我研究的MySQL website这个问题,但我仍然不知道如何解决这个问题。

有谁知道我该如何解决这个问题,以及需要运行哪些设置或脚本来修改设置,以便我可以在表中添加更多列?

+0

你是男人!这真是令人印象深刻。 – a1ex07 2013-03-10 00:11:13

回答

3

为什么您的行大小64k开始?那是你的问题。不是设置太低。

来源:

http://dev.mysql.com/doc/refman/5.0/en/column-count-limit.html

Each table has an .frm file that contains the table definition. The server uses the following expression to check some of the table information stored in the file against an upper limit of 64KB:

> if (info_length+(ulong) create_fields.elements*FCOMP+288+ 
>  n_length+int_length+com_length > 65535L || int_count > 255) 

所以它不太可能的东西,你可以很容易地改变(短修改源代码,并运行自定义的MySQL给我们您的模式,我们可能。能够更好地提供建议,但简短的答案似乎是你有太多的列,或者需要将某些VARCHAR等改为text/blob。

如果没有看到(很可能是a)模式的可能性,很难提供建议。

+0

+1解释。但是,我不同意在最后一句中的'可能'和'模式'这两个字。我曾经认为拥有10-20个以上的列通常是一个或另一个正常形式或设计问题的突破(即使没有研究细节)。但是达到了领域的极限......这超出了我的理解。 – a1ex07 2013-03-10 00:26:50

+0

我能够通过将varchar的某些列更新为文本来解决问题。 – Dani 2013-03-10 10:12:35