Mysql char varchar blob text performance details, varcharblob
Char
Fixed Length, up to 255 bytes. If the storage space is not full, a space will be filled on the right side of the data.
Varchar
The maximum length is 65536 bytes. When the varchar length is smaller than 4, The varchar is automatically converted to char ..
Blob
Stores binary strings
TinyBlob Max. 255 bytes
Blob Max 65 K
MediumBlob up to 16 MB
Up to 4 GB LongBlob
Text
Store large text
TINYTEXT: 256 bytes
TEXT: 65,535 bytes => ~ 64kb
MEDIUMTEXT: 16,777,215 bytes => ~ 16 MB
LONGTEXT: 4,294,967,295 bytes => ~ 4 GB
Char varchar Performance Comparison
Different types are selected for different scenarios.
See: http://zhumeng8337797.blog.163.com/blog/static/100768914201112710039854/
Char:
Advantage: update is more efficient than varchar
Disadvantage: The fixed length will waste disk space, and the storage content is not filled with spaces. Due to the large disk space usage, the query efficiency is lower than that of varchar.
Varchar:
Advantage: select queries are efficient, saving disk space compared with char, so queries are faster.
Disadvantage: During update, if the new data is larger than the original data, the database needs to open up space again, which may result in performance loss. The efficiency is not fixed. The char is high.