Do you know the difference between the varchar and text types in MySQL? Up until MySQL 5.0.3, the varchar data type could only hold up to 255 characters, but from 5.0.3 onwards, it can store up to 65,535, which means that it can store data that previously would have been held in text fields. This is important because text is a fundamentally different data type to varchar. In fact is is similar to the blob data type, and has a couple of disadvantages:
- You can’t make a complete index on a text column, so MySQL will often have to read from the table.
- MySQL can’t make temporary tables in memory for tables that use text columns, it has to create temp tables on disc for them.
So most of the time you’ll probably be better off using varchar columns rather than text. For more info, see:
How MySQL uses temporary tables: