更新text字段時(shí)出現(xiàn)Row size too large報(bào)錯(cuò)應(yīng)付措施
更新時(shí)間:2013年03月06日 16:14:22 作者:
個(gè)人建議:表的text字段很多建議建表時(shí)加上 row_format = dynamic當(dāng)然,回過(guò)頭來(lái)MySQL的報(bào)錯(cuò)也是有誤導(dǎo)性的,感興趣的你可以參考下本文
起因:
團(tuán)購(gòu)開(kāi)發(fā)報(bào)告說(shuō)更新時(shí)出錯(cuò)。
更新SQL如下:
UPDATE table_name d SET d.column_name='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
WHERE d.ID=100976;
報(bào)錯(cuò)信息如下:
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類型。
個(gè)人之前理解是:
TEXT的內(nèi)容在 Dynamic的table format下是存在off-page中的,不會(huì)占用row size的計(jì)算。
Barracuda 對(duì)應(yīng)row_format ( dynamic, compress) ,其中dynamic下text的所有內(nèi)容都是off-page存放的 (點(diǎn)擊查看)
Antelope 對(duì)應(yīng)row_format (compact, redundant),其中compact下的text是存786B在row中,超過(guò)部分存在off-page
而服務(wù)器配置是 innodb_file_format = Barracuda
照理說(shuō)所有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.
也就是說(shuō),建表時(shí)不顯示指定 row_format = dynamic ,即使 innodb_file_format = Barracuda 表的row-format還是 compact
所以總結(jié)為一句話就是:如果某個(gè)表的text字段很多建議建表時(shí)加上 row_format = dynamic
當(dāng)然,回過(guò)頭來(lái)MySQL的報(bào)錯(cuò)也是有誤導(dǎo)性的,bug庫(kù)中也對(duì)confirm了這個(gè)bug(點(diǎn)擊查看),并在5.1.61中優(yōu)化了報(bào)錯(cuò)提示。
團(tuán)購(gòu)開(kāi)發(fā)報(bào)告說(shuō)更新時(shí)出錯(cuò)。
更新SQL如下:
復(fù)制代碼 代碼如下:
UPDATE table_name d SET d.column_name='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
WHERE d.ID=100976;
報(bào)錯(cuò)信息如下:
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類型。
個(gè)人之前理解是:
TEXT的內(nèi)容在 Dynamic的table format下是存在off-page中的,不會(huì)占用row size的計(jì)算。
Barracuda 對(duì)應(yīng)row_format ( dynamic, compress) ,其中dynamic下text的所有內(nèi)容都是off-page存放的 (點(diǎn)擊查看)
Antelope 對(duì)應(yīng)row_format (compact, redundant),其中compact下的text是存786B在row中,超過(guò)部分存在off-page
而服務(wù)器配置是 innodb_file_format = Barracuda
照理說(shuō)所有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.
也就是說(shuō),建表時(shí)不顯示指定 row_format = dynamic ,即使 innodb_file_format = Barracuda 表的row-format還是 compact
所以總結(jié)為一句話就是:如果某個(gè)表的text字段很多建議建表時(shí)加上 row_format = dynamic
當(dāng)然,回過(guò)頭來(lái)MySQL的報(bào)錯(cuò)也是有誤導(dǎo)性的,bug庫(kù)中也對(duì)confirm了這個(gè)bug(點(diǎn)擊查看),并在5.1.61中優(yōu)化了報(bào)錯(cuò)提示。
相關(guān)文章
mysql+Spring數(shù)據(jù)庫(kù)隔離級(jí)別與性能分析
數(shù)據(jù)庫(kù)隔離級(jí)別與Spring配置事務(wù)的聯(lián)系及性能影響,以下是個(gè)人理解,如果有瑕疵請(qǐng)及時(shí)指正2014-05-05使用JDBC從數(shù)據(jù)庫(kù)中查詢數(shù)據(jù)的方法
下面小編就為大家?guī)?lái)一篇使用JDBC從數(shù)據(jù)庫(kù)中查詢數(shù)據(jù)的方法。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2016-08-08解讀mysql主從配置及其原理分析(Master-Slave)
在windows下配置的,后面會(huì)在Linux下配置進(jìn)行測(cè)試,需要配置mysql數(shù)據(jù)庫(kù)同步的朋友可以參考下。2011-05-05MySQL 數(shù)據(jù)查重、去重的實(shí)現(xiàn)語(yǔ)句
這篇文章主要介紹了MySQL 數(shù)據(jù)查重、去重的實(shí)現(xiàn)語(yǔ)句,幫助大家更好的理解和學(xué)習(xí)MySQL數(shù)據(jù)庫(kù),感興趣的朋友可以了解下2020-09-09sql腳本函數(shù)編寫(xiě)postgresql數(shù)據(jù)庫(kù)實(shí)現(xiàn)解析
這篇文章主要介紹了sql腳本函數(shù)編寫(xiě)postgresql數(shù)據(jù)庫(kù)實(shí)現(xiàn)解析,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2019-09-09Ubuntu中更改MySQL數(shù)據(jù)庫(kù)文件目錄的方法
這篇文章主要給大家介紹了關(guān)于在Ubuntu中更改MySQL數(shù)據(jù)庫(kù)文件目錄的相關(guān)資料,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2018-11-11MySQL數(shù)據(jù)庫(kù)的索引原理與慢SQL優(yōu)化的5大原則
這篇文章主要介紹了MySQL數(shù)據(jù)庫(kù)的索引原理與慢SQL優(yōu)化的5大原則,包括:建立索引的原則,慢查詢優(yōu)化基本步驟,慢查詢優(yōu)化案例,explain使用,需要的朋友可以參考下2023-02-02