更新text字段時出現(xiàn)Row size too large報錯應(yīng)付措施
更新時間:2013年03月06日 16:14:22 作者:
個人建議:表的text字段很多建議建表時加上 row_format = dynamic當(dāng)然,回過頭來MySQL的報錯也是有誤導(dǎo)性的,感興趣的你可以參考下本文
起因:
團(tuán)購開發(fā)報告說更新時出錯。
更新SQL如下:
UPDATE table_name d SET d.column_name='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
WHERE d.ID=100976;
報錯信息如下:
Error Code : 1118
Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs
疑惑:
更新字段只涉及 column_name字段,且該字段是TEXT類型。
個人之前理解是:
TEXT的內(nèi)容在 Dynamic的table format下是存在off-page中的,不會占用row size的計算。
Barracuda 對應(yīng)row_format ( dynamic, compress) ,其中dynamic下text的所有內(nèi)容都是off-page存放的 (點擊查看)
Antelope 對應(yīng)row_format (compact, redundant),其中compact下的text是存786B在row中,超過部分存在off-page
而服務(wù)器配置是 innodb_file_format = Barracuda
照理說所有table用的都是 dynamic 結(jié)構(gòu)。
但是! 原因如下,摘自文檔:
To preserve compatibility with those prior versions, tables created with the InnoDB Plugin use the prefix format, unless one of ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED is specified (or implied) on the CREATE TABLE command.
也就是說,建表時不顯示指定 row_format = dynamic ,即使 innodb_file_format = Barracuda 表的row-format還是 compact
所以總結(jié)為一句話就是:如果某個表的text字段很多建議建表時加上 row_format = dynamic
當(dāng)然,回過頭來MySQL的報錯也是有誤導(dǎo)性的,bug庫中也對confirm了這個bug(點擊查看),并在5.1.61中優(yōu)化了報錯提示。
團(tuán)購開發(fā)報告說更新時出錯。
更新SQL如下:
復(fù)制代碼 代碼如下:
UPDATE table_name d SET d.column_name='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
WHERE d.ID=100976;
報錯信息如下:
Error Code : 1118
Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs
疑惑:
更新字段只涉及 column_name字段,且該字段是TEXT類型。
個人之前理解是:
TEXT的內(nèi)容在 Dynamic的table format下是存在off-page中的,不會占用row size的計算。
Barracuda 對應(yīng)row_format ( dynamic, compress) ,其中dynamic下text的所有內(nèi)容都是off-page存放的 (點擊查看)
Antelope 對應(yīng)row_format (compact, redundant),其中compact下的text是存786B在row中,超過部分存在off-page
而服務(wù)器配置是 innodb_file_format = Barracuda
照理說所有table用的都是 dynamic 結(jié)構(gòu)。
但是! 原因如下,摘自文檔:
To preserve compatibility with those prior versions, tables created with the InnoDB Plugin use the prefix format, unless one of ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED is specified (or implied) on the CREATE TABLE command.
也就是說,建表時不顯示指定 row_format = dynamic ,即使 innodb_file_format = Barracuda 表的row-format還是 compact
所以總結(jié)為一句話就是:如果某個表的text字段很多建議建表時加上 row_format = dynamic
當(dāng)然,回過頭來MySQL的報錯也是有誤導(dǎo)性的,bug庫中也對confirm了這個bug(點擊查看),并在5.1.61中優(yōu)化了報錯提示。
相關(guān)文章
navicat連接mysql出現(xiàn)2059錯誤的解決方法
這篇文章主要為大家詳細(xì)介紹了navicat連接mysql出現(xiàn)2059錯誤的解決方法,具有一定的參考價值,感興趣的小伙伴們可以參考一下2018-11-11
Mysql的Binlog數(shù)據(jù)恢復(fù):不小心刪除數(shù)據(jù)庫詳解
這篇文章主要介紹了Mysql的Binlog數(shù)據(jù)恢復(fù),文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2019-04-04
MySQL學(xué)習(xí)之日期函數(shù)的用法詳解
本文將學(xué)習(xí)MySQL的日期函數(shù),在前面章節(jié)的練習(xí)中,我們就利用過NOW()函數(shù)來獲取過當(dāng)前系統(tǒng)時間,用DATEDIFF函數(shù)來計算日期相差的天數(shù),接下來我們就系統(tǒng)的學(xué)習(xí)一下 日期函數(shù)2022-08-08

