怪我咯2017-04-17 15:08:53
Compared to int, varchar takes up more disk space, has more disk IO, and has more memory bandwidth. This is especially obvious in innodb. The leaf page of the secondary index of the innodb table must store the value of the primary key. If the primary key is varchar, the size of the secondary index will be larger. Moreover, the varchar primary key will be slower in comparison. It is easy to send non-sequential insertion of data during insertion, resulting in fragmentation. The index tree efficiency is lower than that of int
巴扎黑2017-04-17 15:08:53
Very wasteful and unprofessional.
If it is char() type, the value given is 5. Then regardless of whether there is a value in the field, even null
will occupy 5×当前数据库编码字节
. varchar() will first use one byte to record the maximum range of the type. If no value is passed, it will only record the first byte. If it is passed, the content within the maximum range of the value will be stored.
The hard disk space occupied by each record of the remaining fields will be discussed separately.
阿神2017-04-17 15:08:53
Everything said above is correct
Maybe the content he recorded is UUID
Many jsp programming libraries are like this when designing libraries, I don’t know why