There are three sizes: TINYTEXT, TEXT, MEDIUMTEXT, and LONGTEXT.
Type | Size (bytes) |
---|---|
TINYTEXT | 255 |
TEXT | 65535 |
MEDIUMTEXT | 16777215 |
LONGTEXT | 4294967295 |
With the exception of TINYTEXT, The others are stored off-page, and it is harder to index these values. Text is great for things like storing posts, articles, novels, etc...except for TINYTEXT of course.
Breaking this down Barney-style, Text is:
Great at storing blobs of text that are unpredictable in length.
Limited indexing support
Slow indexing
Slower to retrieve
VarChar is similar to TINYTEXT in size, 255 Bytes. Unlike it's TEXT cousin, it does not store off-page. Unlike with TEXT, you can restrict length by doing something like VARCHAR(30). Just setting VARCHAR will set it at max (255).
Again, Barney-style:
Great for predictable text like usernames, passwords, and emails
Full indexing support
Fast indexing
Fast retrieval
Depends on what data you expect you need to be stored and what database you're using. Postgres for example only uses Text as it handles Text types differently.