Short Answer: TEXT
and BLOB
will be about the same speed.
Long Answer:
- Ultimately
TEXT
and BLOB
are just a bunch of bytes. The main cost in inserting/fetching such columns is in finding the row and parsing it. In some situations, the bytes are "off-record", thereby necessitation an extra disk hit (unless cached).
- There is some CPU processing difference. But this is relatively minor. When moving
TEXT
between the table and the client, the CHARACTER SET
may be changed; this costs something. (Not applicable to BLOB
or any %_bin
COLLATION
.)
- Another CPU diff: When
INSERTing
data, the characters are checked for validity. This causes errors if you have bytes that do not match the encoding specified for the client.
Note that the differences say that TEXT
may be slightly slower than BLOB
.
Here's another technique... If you have some moderately large text fields, it is actually faster than TEXT
or BLOB
to have the client COMPRESS
the text, then store into a BLOB
column. The reason why this is likely to be faster is that fewer bytes need to be shoveled around. And the buffer_pool cache is more effective. (Note: I am not talking about ROW_FORMAT=COMPRESSED
.)