What is the disadvantage to using a MySQL longtext sized field when every entry will fit within a mediumtext sized field?

前端 未结 2 1055
眼角桃花
眼角桃花 2020-12-14 01:35

What is the disadvantage to using a MySQL longtext sized field when every entry will fit within a mediumtext sized field?

The reason I am asking is because I have so

2条回答
  •  天涯浪人
    2020-12-14 02:00

    The only storage size difference is the number of bytes allocated for the "how many bytes is this field" number. From the fine manual:

    TINYTEXT    L + 1 bytes, where L < 2^8  
    TEXT        L + 2 bytes, where L < 2^16
    MEDIUMTEXT  L + 3 bytes, where L < 2^24
    LONGTEXT    L + 4 bytes, where L < 2^32
    

    So a longtext will use one more byte than mediumtext to store the same text. There is a bit more information in the Data Type Storage Requirements section of the manual and some more in the The BLOB and TEXT Types section.

    There's no practical difference between the four TEXT types.

提交回复
热议问题