The impact of mysql field varchar length allocation on performance

The space overhead of using varchar(5) and varchar(200) to store'hello' is the same, so is there any advantage to using a shorter column?

Facts have proved to have great advantages. Longer columns consume more memory, because MySQL usually allocates fixed-size memory blocks to store internal values. Especially when using memory temporary tables

It is particularly bad when sorting or manipulating. It is also bad when sorting using disk temporary tables.

So the best strategy is to allocate only the space that is really needed.

mysql database: how many Chinese characters and numbers can be stored in varchar type

Guess you like

Origin blog.csdn.net/weixin_41822224/article/details/106572388