MySQL TEXT vs BLOB vs CLOB

前端 未结 2 707
臣服心动
臣服心动 2020-11-28 07:06

What are the differences, advantages and disadvantages of these different data-types both from a performance standpoint as well as a usability standpoint?

2条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-28 08:06

    It's worth to mention that CLOB / BLOB data types and their sizes are supported by MySQL 5.0+, so you can choose the proper data type for your need.

    http://dev.mysql.com/doc/refman/5.7/en/storage-requirements.html

    Data Type   Date Type   Storage Required
    (CLOB)      (BLOB)
    
    TINYTEXT    TINYBLOB    L + 1 bytes, where L < 2**8  (255)
    TEXT        BLOB        L + 2 bytes, where L < 2**16 (64 K)
    MEDIUMTEXT  MEDIUMBLOB  L + 3 bytes, where L < 2**24 (16 MB)
    LONGTEXT    LONGBLOB    L + 4 bytes, where L < 2**32 (4 GB)
    
    where L stands for the byte length of a string
    

提交回复
热议问题