Jump to content

Never use VARCHAR?


freelance84

Recommended Posts

I recently came across this link: http://www.softwareprojects.com/resources/programming/t-never-use-varchar-in-mysql-1916.html

 

The person who wrote it states it is best to never use VARCHAR and use either CHAR or TEXT, claiming the space saved is negligible compared to the problems it can cause.

 

There has only been one post to his claims but wondered if any one else had any comments on it... (i use varchar a lot due to the book i learnt from)

Link to comment
Share on other sites

Yeah, that's nonsense.

 

The mismatch issue is just poor DBA management -- that will happen with CHAR, too.

 

The conversion at lower length doesn't matter.

 

And MySQL 5 support VARCHAR up to 65k, so there's no need to get into TEXT/BLOB hell for >255 anymore.

 

Yes, if most of your data is taking up most of the VARCHAR space, then you don't get any benefit from the variable length aspect, and don't bother.  But in the real-world, it's impossible to know.

 

Also -- and the blog neglected to mention this -- if you have even one variable-length field in your table, you won't get any benefit from the fixed-width ones.  In fact, I'm fairly certain that they get converted to VARCHAR without even asking you.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.