Short answer: No practical, performance, or storage, difference.
Long answer:
There is essentially no difference (in MySQL) between VARCHAR(3000)
(or any other large limit) and TEXT
. The former will truncate at 3000 characters; the latter will truncate at 65535 bytes. (I make a distinction between bytes and characters because a character can take multiple bytes.)
For smaller limits in VARCHAR
, there are some advantages over TEXT
.
- "smaller" means 191, 255, 512, 767, or 3072, etc, depending on version, context, and
CHARACTER SET
.
INDEXes
are limited in how big a column can be indexed. (767 or 3072 bytes; this is version and settings dependent)
- Intermediate tables created by complex
SELECTs
are handled in two different ways -- MEMORY (faster) or MyISAM (slower). When 'large' columns are involved, the slower technique is automatically picked. (Significant changes coming in version 8.0; so this bullet item is subject to change.)
- Related to the previous item, all
TEXT
datatypes (as opposed to VARCHAR
) jump straight to MyISAM. That is, TINYTEXT
is automatically worse for generated temp tables than the equivalent VARCHAR
. (But this takes the discussion in a third direction!)
VARBINARY
is like VARCHAR
; BLOB
is like TEXT
.
- A table with several 'large'
VARCHARs
could hit a limit of 64KB for the whole table definition; switching to TEXT
is a simple and practical fix. (Example: (42000) Row size too large, from an Oracle dump to a MySQL dump )
Rebuttal to other answers
The original question asked one thing (which datatype to use); the accepted answer answered something else (off-record storage). That answer is now out of date.
When this thread was started and answered, there were only two "row formats" in InnoDB. Soon afterwards, two more formats (DYNAMIC
and COMPRESSED
) were introduced.
The storage location for TEXT
and VARCHAR()
is based on size, not on name of datatype. For an updated discussion of on/off-record storage of large text/blob columns, see this .