MYSQL BLOB 字段大小以及個數的限制測試。


測試結論
mysql版本號 5.1
    表類型: innodb, row_format=compact (這是默認的行格式)


    插入超過10個blob, blob的數據量非常小(<768字節), 插入成功。
    插入超過10個blob, blob的數據量非常大(>768字節), 插入失敗:報 Got error 139 from storage engine。


    注意,假設mysqlserver版本號是5.1, innodb_file_format選項不存在, 也就無從談起Barracuda格式。 設置row_format=dynamic也是沒意義的。


mysql版本號 5.5
    表類型: innodb, row_format=compact (這是默認的行格式)
    插入超過10個blob, blob的數據量非常大(>768字節), 插入失敗:報 Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.


    表類型: innodb, row_format=dynamic (這是innodb的新文件存儲格式Barracuda所支持的行格式)
    插入超過10個blob, blob的數據量非常大(>768字節), 插入成功


備注:
    1) 實際測試測試我用的每一個字段長度都是100K+
    2) 對於mysql5.5, 盡管支持Barracuda。可是默認使用的還是老的格式:Antelope
        除非在mysql的配置里面my.cnf改動:
        innodb_file_per_table = 1                                                                                                                                  
        innodb_file_format = Barracuda
        或者set global 命令動態的改動:
        SET GLOBAL innodb_file_format=barracuda;
        SET GLOBAL innodb_file_per_table=1;


        注意:
        1) 改動后的innodb_file_format格式, 僅僅影響興許創建的表。 也就是興許創建的表,能夠支持把row_format設為dynamic
        2) SET GLOBAL 僅僅是在mysqlserver執行期間有效,重新啟動后innodb_file_format還原為原來的格式。
    3) 推斷一個表是否支持超過10個blob的字段的簡單辦法:
        show table status like 't1' \G
        查看 Row_format , 假設是Compact, 必然不支持, 假設是dynamic, 則支持。


        


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM