Char vs tinytext

What is the difference between char and tinytext in MySQL?

+3
source share
2 answers

char[] fixed, and tinytext up to 255 characters.

+5
source

One of the differences is how MySQL stores data.

In the TEXT field, MySQL will allocate 256 bytes in the source table, and then store the rest of the data in 2,000 byte fragments in a separate hidden table.

In the CHAR field, you must declare a fixed size when creating the table (up to 256), and MySQL will always use this space to store each record (filling in the blanks as necessary).

+1
source

Source: https://habr.com/ru/post/1753365/


All Articles