MySQL Varchar Can Now Contain More Than 255 Characters

Found an interesting new feature for MySQL when I was randomly reading the MySQL 5.0.x change logs.

Beginning from MySQL 5.0.3:

VARCHAR columns now remember end space. A VARCHAR() column can now contain up to 65535 bytes.

Prior to MySQL 5.0.3, varchar can only contain up to maximum of 255 characters. However, from MySQL5.0.3 and onwards, we can now declare varchar with more than 255 characters.

Don’t Exceed The 65,535 bytes Maximum Row Size

However, do note that, the maximum row size for MySQL is 65,535 bytes, shared among all columns within a row. Which also means, if you have more than 1 column in a table, declaring a column with varchar(65,535) is not feasible. Besides, UTF8 characters can also require up to 3 bytes per character.

Trailing Space Will Be Retained

Prior to MySQL 5.0.3, any trailing space of a string will be removed when it’s stored as varchar. But beginning from MySQL 5.0.3 and later, varchar is handled with better conformance to standard - trailing space will be retained.

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google
  • BlinkList
  • StumbleUpon
  • TwitThis

Related Posts:

0 Responses to “MySQL Varchar Can Now Contain More Than 255 Characters”


  1. No Comments

Leave a Reply




Subscribe

Subscribe to my RSS Feeds

Subscribe by Email

Enter your email address:

Delivered by FeedBurner

My Tweets

Powered by Twitter Tools.