今天項目中需要增加一個表字段的長度,提示 Error Code: 1118. 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文檔,發現字段單表行長度有65535字節數的限制。下邊的博友 wenlj2000
的這邊文章已經寫得比較詳細,就直接摘錄過來了
https://www.cnblogs.com/wenlj/p/4922777.html
第一種解決方式 是 將字段從varchar 轉化為 text,但項目中表的數據量非常大
第二種解決方式 是 拆分表,但已有的代碼不是很好調整
比較下也只有使用第一種方式
在此記錄,希望以后數據庫設計初期需要盡量全面考慮,如果單表行長度比較大時而且后期存在增加字段長度的可能,要盡量提前考慮分表或改用text