Use what you need and don't worry about performance. But use only what you need. There are minor inefficiencies in saying TEXT
when VARCHAR(255)
will suffice. Ditto for VARCHAR(255)
when VARCHAR(20)
will suffice.
Here's why: If a SELECT
needs build a tmp table (eg, for ORDER BY
), it first tries to use a MEMORY
tmp table (better), but may have to fall back on a MyISAM
table (slower). Any kind of TEXT
or BLOB
forces MyISAM
. VARCHAR
turns into CHAR
(for the tmp table); if the tmp table gets too big for MEMORY
, it converts to MyISAM
.
TINYTEXT
is probably never a good idea.
A related issue: CHAR(...)
is useful only if the field is (1) constant length, and (2) declared with the appropriate CHARACTER SET
. A common mistake is putting a fixed-length hex string in a utf8 CHAR field.
VARCHAR
and TEXT
(all sizes) have a small length field prefixing them. This is relatively insignificant.