MySql "Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs"
第一、在MySQL中,每一張資料表最多僅可以有4096個欄位,但是實際的情形會因為一些因素而少於4096個欄位,例如maximum row size constrains。
第二、InnoDB限制row size的大小,但是部分欄位不再此限。
-
InnoDB
restricts row size to something less than half a database page (approximately 8000 bytes), not includingVARBINARY
,VARCHAR
,BLOB
, orTEXT
columns.
當資料表的欄位過多,衍生一個問題,各個欄位的長度加總超出maximum row size constrains的限制時,將會出現下列錯誤:
Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs
倘若使用Code First連接MySQL,解決的方式在於Data Annotation:
public string Description { get; set; }
資料來源:
[1]D.7.4 Limits on Table Column Count and Row Size
https://dev.mysql.com/doc/refman/5.0/en/column-count-limit.html
[2]How do I specify that a property should generate a TEXT column rather than an nvarchar(4000)
http://stackoverflow.com/questions/4895465/how-do-i-specify-that-a-property-should-generate-a-text-column-rather-than-an-nv