Feb 01 2013

MySQL: Large VARCHAR vs TEXT?

Posted by Gerrit Schimpf in MySQL
Tags: , | 1 Comment

If you have to store big texts in MySQL you have to choose in between using a big VARCHAR column and the TEXT type. So what are the differences between using for example a VARCHAR(2000) and TEXT?

The difference between TEXT and the VARCHAR type is how MySQL is storing the data. TEXT (and BLOB) data is stored off the table, leaving only a pointer to the actual storage.

So using VARCHAR is faster when the size of the data is reasonable. How big the performance difference is depends on the data and the used hardware.

Due the row length limit of 65,535 bytes the data you can store in the table itself is limited (Using utf8 2000 chars could use up to 6000 bytes).

One Response to “MySQL: Large VARCHAR vs TEXT?”

  1. erin Says:

    But what about in RDS? Programmers w/o a DBA use RDS in the cloud. And frameworks prefer TEXT…..

    thoughts?
    thanks,
    erin

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>


5 − = four