Which is best?
Put simply, use a VARCHAR field instead of TEXT for columns between 255 and 65k characters if possible as it will lead to potentially fewer disk reads and less writes.
VARCHAR
- Max size of 65535 characters
- Uses 2+n bytes to store the value where n is the length of the stored string.
- Stored inline within the table like other values
- Can be handled in memory
- Can be indexed
TEXT
- Max size of 65535 characters (more for mediumtext and longtext)
- Uses 2+n bytes to store the value where n is the length of the stored string.
- TEXT is stored off table with the table having a pointer to the location of the actual storage.
- Using a TEXT column in a sort or in the results will require the use of a disk-based temporary table as it can’t be handled in RAM.
