MySQL Type Performance (varchar vs text)

Great article about the difference between the varchar type and the text type in MySQL.

To quote (emphasis added):

[L]et’s start out with the two new VARCHAR(30000) columns.  In a normal MyISAM table, with a dynamically sized row, these two columns only take as much space as the data they contain (plus 1 byte).  That is, if I had a row and these two columns only had 10 bytes of data in them, the row size would be (10+1)*2+[other columns].  However, if I happened to convert this MyISAM table to use fixed-length rows, or I was using the MEMORY storage engine, the row size would be 30000*2+[other columns].  Currently, according to my dataset, these dynamically sized rows only required an average of 1,648 bytes per row.

The full article can be viewed here.

This entry was posted in Databases. Bookmark the permalink.

Comments are closed.